PageRenderTime 20ms CodeModel.GetById 14ms app.highlight 4ms RepoModel.GetById 1ms 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
 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
10
11goog.provide('ydn.debug.error.ArgumentException');
12goog.provide('ydn.debug.error.NotSupportedException');
13goog.provide('ydn.debug.error.NotImplementedException');
14goog.provide('ydn.debug.error.InvalidOperationException');
15goog.provide('ydn.debug.error.InternalError');
16
17goog.require('goog.debug.Error');
18
19
20/**
21 * Base class for custom error objects.
22 * @param {*=} opt_msg The message associated with the error.
23 * @constructor
24 * @extends {goog.debug.Error}
25 */
26ydn.debug.error.ArgumentException = function (opt_msg) {
27  goog.base(this, opt_msg);
28  this.name = 'ydn.error.ArgumentException';
29};
30goog.inherits(ydn.debug.error.ArgumentException, goog.debug.Error);
31
32
33/**
34 * Base class for custom error objects.
35 * @param {*=} opt_msg The message associated with the error.
36 * @constructor
37 * @extends {goog.debug.Error}
38 */
39ydn.debug.error.NotSupportedException = function (opt_msg) {
40  goog.base(this, opt_msg);
41  this.name = 'ydn.error.NotSupportedException';
42};
43goog.inherits(ydn.debug.error.NotSupportedException, goog.debug.Error);
44
45
46/**
47 * Base class for custom error objects.
48 * @param {*=} opt_msg The message associated with the error.
49 * @constructor
50 * @extends {goog.debug.Error}
51 */
52ydn.debug.error.NotImplementedException = function(opt_msg) {
53  goog.base(this, opt_msg);
54  this.name = 'ydn.error.NotImplementedException';
55};
56goog.inherits(ydn.debug.error.NotImplementedException, goog.debug.Error);
57
58
59/**
60 * Base class for custom error objects.
61 * @param {*=} opt_msg The message associated with the error.
62 * @constructor
63 * @extends {goog.debug.Error}
64 */
65ydn.debug.error.InvalidOperationException = function(opt_msg) {
66  goog.base(this, opt_msg);
67  this.name = 'ydn.error.InvalidOperationException';
68};
69goog.inherits(ydn.debug.error.InvalidOperationException, goog.debug.Error);
70
71
72/**
73 * Base class for custom error objects.
74 * @param {*=} opt_msg The message associated with the error.
75 * @constructor
76 * @extends {Error}
77 */
78ydn.debug.error.InternalError = function(opt_msg) {
79
80  // Ensure there is a stack trace.
81  if (Error.captureStackTrace) {
82    Error.captureStackTrace(this, ydn.debug.error.InternalError);
83  } else {
84    this.stack = new Error().stack || '';
85  }
86
87  if (opt_msg) {
88    this.message = String(opt_msg);
89  }
90  this.name = 'ydn.error.InternalError';
91};
92goog.inherits(ydn.debug.error.InternalError, Error);
93
94ydn.debug.error.InternalError.prototype.name = 'ydn.error.InternalError';