RuntimeError-61701d3e.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* This file is automatically rebuilt by the Cesium build process. */
  2. define(['exports', './when-e6985d2a'], function (exports, when) { 'use strict';
  3. /**
  4. * Constructs an exception object that is thrown due to an error that can occur at runtime, e.g.,
  5. * out of memory, could not compile shader, etc. If a function may throw this
  6. * exception, the calling code should be prepared to catch it.
  7. * <br /><br />
  8. * On the other hand, a {@link DeveloperError} indicates an exception due
  9. * to a developer error, e.g., invalid argument, that usually indicates a bug in the
  10. * calling code.
  11. *
  12. * @alias RuntimeError
  13. * @constructor
  14. * @extends Error
  15. *
  16. * @param {String} [message] The error message for this exception.
  17. *
  18. * @see DeveloperError
  19. */
  20. function RuntimeError(message) {
  21. /**
  22. * 'RuntimeError' indicating that this exception was thrown due to a runtime error.
  23. * @type {String}
  24. * @readonly
  25. */
  26. this.name = "RuntimeError";
  27. /**
  28. * The explanation for why this exception was thrown.
  29. * @type {String}
  30. * @readonly
  31. */
  32. this.message = message;
  33. //Browsers such as IE don't have a stack property until you actually throw the error.
  34. var stack;
  35. try {
  36. throw new Error();
  37. } catch (e) {
  38. stack = e.stack;
  39. }
  40. /**
  41. * The stack trace of this exception, if available.
  42. * @type {String}
  43. * @readonly
  44. */
  45. this.stack = stack;
  46. }
  47. if (when.defined(Object.create)) {
  48. RuntimeError.prototype = Object.create(Error.prototype);
  49. RuntimeError.prototype.constructor = RuntimeError;
  50. }
  51. RuntimeError.prototype.toString = function () {
  52. var str = this.name + ": " + this.message;
  53. if (when.defined(this.stack)) {
  54. str += "\n" + this.stack.toString();
  55. }
  56. return str;
  57. };
  58. exports.RuntimeError = RuntimeError;
  59. });