PageRenderTime 46ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/support/closure-library/closure/goog/debug/error.js

https://github.com/nickg33/skulpt
JavaScript | 45 lines | 9 code | 9 blank | 27 comment | 2 complexity | a28cb46943d82e509a221ac6d0d221af MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, Apache-2.0, BSD-3-Clause
  1. // Copyright 2009 The Closure Library Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS-IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /**
  15. * @fileoverview Provides a base class for custom Error objects such that the
  16. * stack is corectly maintained.
  17. *
  18. *
  19. */
  20. goog.provide('goog.debug.Error');
  21. /**
  22. * Base class for custom error objects.
  23. * @param {*=} opt_msg The message associated with the error.
  24. * @constructor
  25. * @extends {Error}
  26. */
  27. goog.debug.Error = function(opt_msg) {
  28. // Ensure there is a stack trace.
  29. this.stack = new Error().stack || '';
  30. if (opt_msg) {
  31. this.message = String(opt_msg);
  32. }
  33. };
  34. goog.inherits(goog.debug.Error, Error);
  35. /** @inheritDoc */
  36. goog.debug.Error.prototype.name = 'CustomError';