PageRenderTime 53ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/js/ydn/debug/error.js

https://bitbucket.org/ytkyaw/ydn-base
JavaScript | 94 lines | 39 code | 16 blank | 39 comment | 4 complexity | d26e30f634cb8edcf46fa9789fa30eea MD5 | raw file
Possible License(s): Apache-2.0
  1. /**
  2. * @fileoverview Utilities function for debug.
  3. *
  4. * NOTE: these code are stripped using compiler prefix feature.
  5. * See more detail in tools/strip_debug.txt file.
  6. *
  7. * @author kyawtun@yathit.com <Kyaw Tun>
  8. */
  9. goog.provide('ydn.debug.error.ArgumentException');
  10. goog.provide('ydn.debug.error.NotSupportedException');
  11. goog.provide('ydn.debug.error.NotImplementedException');
  12. goog.provide('ydn.debug.error.InvalidOperationException');
  13. goog.provide('ydn.debug.error.InternalError');
  14. goog.require('goog.debug.Error');
  15. /**
  16. * Base class for custom error objects.
  17. * @param {*=} opt_msg The message associated with the error.
  18. * @constructor
  19. * @extends {goog.debug.Error}
  20. */
  21. ydn.debug.error.ArgumentException = function (opt_msg) {
  22. goog.base(this, opt_msg);
  23. this.name = 'ydn.error.ArgumentException';
  24. };
  25. goog.inherits(ydn.debug.error.ArgumentException, goog.debug.Error);
  26. /**
  27. * Base class for custom error objects.
  28. * @param {*=} opt_msg The message associated with the error.
  29. * @constructor
  30. * @extends {goog.debug.Error}
  31. */
  32. ydn.debug.error.NotSupportedException = function (opt_msg) {
  33. goog.base(this, opt_msg);
  34. this.name = 'ydn.error.NotSupportedException';
  35. };
  36. goog.inherits(ydn.debug.error.NotSupportedException, goog.debug.Error);
  37. /**
  38. * Base class for custom error objects.
  39. * @param {*=} opt_msg The message associated with the error.
  40. * @constructor
  41. * @extends {goog.debug.Error}
  42. */
  43. ydn.debug.error.NotImplementedException = function(opt_msg) {
  44. goog.base(this, opt_msg);
  45. this.name = 'ydn.error.NotImplementedException';
  46. };
  47. goog.inherits(ydn.debug.error.NotImplementedException, goog.debug.Error);
  48. /**
  49. * Base class for custom error objects.
  50. * @param {*=} opt_msg The message associated with the error.
  51. * @constructor
  52. * @extends {goog.debug.Error}
  53. */
  54. ydn.debug.error.InvalidOperationException = function(opt_msg) {
  55. goog.base(this, opt_msg);
  56. this.name = 'ydn.error.InvalidOperationException';
  57. };
  58. goog.inherits(ydn.debug.error.InvalidOperationException, goog.debug.Error);
  59. /**
  60. * Base class for custom error objects.
  61. * @param {*=} opt_msg The message associated with the error.
  62. * @constructor
  63. * @extends {Error}
  64. */
  65. ydn.debug.error.InternalError = function(opt_msg) {
  66. // Ensure there is a stack trace.
  67. if (Error.captureStackTrace) {
  68. Error.captureStackTrace(this, ydn.debug.error.InternalError);
  69. } else {
  70. this.stack = new Error().stack || '';
  71. }
  72. if (opt_msg) {
  73. this.message = String(opt_msg);
  74. }
  75. this.name = 'ydn.error.InternalError';
  76. };
  77. goog.inherits(ydn.debug.error.InternalError, Error);
  78. ydn.debug.error.InternalError.prototype.name = 'ydn.error.InternalError';