PageRenderTime 13ms CodeModel.GetById 1ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/js/ydn/error.js

https://bitbucket.org/floydpink/ydn-base
JavaScript | 194 lines | 92 code | 42 blank | 60 comment | 28 complexity | ca71d6b674dcfb3fb72ce911f6eb342c MD5 | raw file
  1/**
  2 * @fileoverview About this file.
  3 *
  4 * User: kyawtun
  5 * Date: 7/9/12
  6 */
  7
  8goog.provide('ydn.error');
  9goog.provide('ydn.error.ArgumentException');
 10goog.provide('ydn.error.NotImplementedException');
 11goog.provide('ydn.error.ConstrainError');
 12goog.provide('ydn.error.NotSupportedException');
 13goog.provide('ydn.error.InternalError');
 14goog.provide('ydn.error.InvalidOperationException');
 15goog.provide('ydn.error.InvalidOperationError');
 16
 17
 18
 19
 20/**
 21 * Base class for custom error objects.
 22 * @param {*=} opt_msg The message associated with the error.
 23 * @constructor
 24 * @extends {Error}
 25 */
 26ydn.error.ArgumentException = function(opt_msg) {
 27
 28  // Ensure there is a stack trace.
 29  if (Error.captureStackTrace) {
 30    Error.captureStackTrace(this, ydn.error.ArgumentException);
 31  } else {
 32    this.stack = new Error().stack || '';
 33  }
 34
 35  if (opt_msg) {
 36    this.message = String(opt_msg);
 37  }
 38};
 39goog.inherits(ydn.error.ArgumentException, Error);
 40
 41/** @override */
 42ydn.error.ArgumentException.prototype.name = 'ydn.ArgumentException';
 43
 44
 45
 46/**
 47 * Base class for custom error objects.
 48 * @param {*=} opt_msg The message associated with the error.
 49 * @constructor
 50 * @extends {Error}
 51 */
 52ydn.error.NotSupportedException = function(opt_msg) {
 53
 54  // Ensure there is a stack trace.
 55  if (Error.captureStackTrace) {
 56    Error.captureStackTrace(this, ydn.error.NotSupportedException);
 57  } else {
 58    this.stack = new Error().stack || '';
 59  }
 60
 61  if (opt_msg) {
 62    this.message = String(opt_msg);
 63  }
 64};
 65goog.inherits(ydn.error.ArgumentException, Error);
 66
 67/** @override */
 68ydn.error.NotSupportedException.prototype.name = 'ydn.NotSupportedException';
 69
 70
 71/**
 72 * Base class for custom error objects.
 73 * @param {*=} opt_msg The message associated with the error.
 74 * @constructor
 75 * @extends {Error}
 76 */
 77ydn.error.NotImplementedException = function(opt_msg) {
 78
 79  // Ensure there is a stack trace.
 80  if (Error.captureStackTrace) {
 81    Error.captureStackTrace(this, ydn.error.NotImplementedException);
 82  } else {
 83    this.stack = new Error().stack || '';
 84  }
 85
 86  if (opt_msg) {
 87    this.message = String(opt_msg);
 88  }
 89};
 90goog.inherits(ydn.error.NotImplementedException, Error);
 91
 92/** @override */
 93ydn.error.NotImplementedException.prototype.name = 'ydn.NotImplementedException';
 94
 95
 96
 97/**
 98 * Base class for custom error objects.
 99 * @param {*=} opt_msg The message associated with the error.
100 * @constructor
101 * @extends {Error}
102 */
103ydn.error.InternalError = function(opt_msg) {
104
105  // Ensure there is a stack trace.
106  if (Error.captureStackTrace) {
107    Error.captureStackTrace(this, ydn.error.InternalError);
108  } else {
109    this.stack = new Error().stack || '';
110  }
111
112  if (opt_msg) {
113    this.message = String(opt_msg);
114  }
115};
116goog.inherits(ydn.error.InternalError, Error);
117
118ydn.error.InternalError.prototype.name = 'ydn.InternalError';
119
120
121/**
122 * Base class for custom error objects.
123 * @param {*=} opt_msg The message associated with the error.
124 * @constructor
125 * @extends {Error}
126 */
127ydn.error.ConstrainError = function(opt_msg) {
128
129  // Ensure there is a stack trace.
130  if (Error.captureStackTrace) {
131    Error.captureStackTrace(this, ydn.error.ConstrainError);
132  } else {
133    this.stack = new Error().stack || '';
134  }
135
136  if (opt_msg) {
137    this.message = String(opt_msg);
138  }
139};
140goog.inherits(ydn.error.ConstrainError, Error);
141
142ydn.error.ConstrainError.prototype.name = 'ydn.ConstrainError';
143
144
145
146/**
147 * Base class for custom error objects.
148 * @param {*=} opt_msg The message associated with the error.
149 * @constructor
150 * @extends {Error}
151 */
152ydn.error.InvalidOperationException = function(opt_msg) {
153
154  // Ensure there is a stack trace.
155  if (Error.captureStackTrace) {
156    Error.captureStackTrace(this, ydn.error.InvalidOperationException);
157  } else {
158    this.stack = new Error().stack || '';
159  }
160
161  if (opt_msg) {
162    this.message = String(opt_msg);
163  }
164};
165goog.inherits(ydn.error.ArgumentException, Error);
166
167/** @override */
168ydn.error.InvalidOperationException.prototype.name = 'ydn.InvalidOperationException';
169
170
171
172/**
173 * Base class for custom error objects.
174 * @param {*=} opt_msg The message associated with the error.
175 * @constructor
176 * @extends {Error}
177 */
178ydn.error.InvalidOperationError = function(opt_msg) {
179
180  // Ensure there is a stack trace.
181  if (Error.captureStackTrace) {
182    Error.captureStackTrace(this, ydn.error.InvalidOperationError);
183  } else {
184    this.stack = new Error().stack || '';
185  }
186
187  if (opt_msg) {
188    this.message = String(opt_msg);
189  }
190};
191goog.inherits(ydn.error.InvalidOperationError, Error);
192
193/** @override */
194ydn.error.InvalidOperationError.prototype.name = 'ydn.InvalidOperationError';