-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
|
||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
|
||
var CustomException = require('./custom-exception'); | ||
/** | ||
* Class standing for the NotImplemented exceptions. | ||
*/ | ||
|
||
var ArgumentInvalidException = (function (_CustomException) { | ||
_inherits(ArgumentInvalidException, _CustomException); | ||
|
||
/** | ||
* Exception constructor. | ||
* @param {string} message - Exception message. | ||
* @param {object} options - Object to add to the exception. | ||
*/ | ||
|
||
function ArgumentInvalidException(message, options) { | ||
_classCallCheck(this, ArgumentInvalidException); | ||
|
||
_CustomException.call(this, 'ArgumentInvalidException', message, options); | ||
} | ||
|
||
return ArgumentInvalidException; | ||
})(CustomException); | ||
|
||
module.exports = ArgumentInvalidException; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
|
||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
|
||
var CustomException = require('./custom-exception'); | ||
/** | ||
* Class standing for the NotImplemented exceptions. | ||
*/ | ||
|
||
var ArgumentNullException = (function (_CustomException) { | ||
_inherits(ArgumentNullException, _CustomException); | ||
|
||
/** | ||
* Exception constructor.. | ||
* @param message {string} - Exception message. | ||
* @param options {object} - Object to add to the exception. | ||
*/ | ||
|
||
function ArgumentNullException(message, options) { | ||
_classCallCheck(this, ArgumentNullException); | ||
|
||
_CustomException.call(this, 'ArgumentNullException', message, options); | ||
} | ||
|
||
return ArgumentNullException; | ||
})(CustomException); | ||
|
||
module.exports = ArgumentNullException; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* Classe standing for custom exception. | ||
* @see https://gist.github.com/daliwali/09ca19032ab192524dc6 | ||
*/ | ||
'use strict'; | ||
|
||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
|
||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
|
||
var CustomException = (function (_Error) { | ||
_inherits(CustomException, _Error); | ||
|
||
function CustomException(name, message, options) { | ||
_classCallCheck(this, CustomException); | ||
|
||
_Error.call(this); | ||
if (Error.hasOwnProperty('captureStackTrace')) { | ||
Error.captureStackTrace(this, this.constructor); | ||
} else { | ||
Object.defineProperty(this, 'stack', { | ||
value: new Error().stack | ||
}); | ||
} | ||
Object.defineProperty(this, 'message', { | ||
value: message | ||
}); | ||
this.options = options; | ||
} | ||
|
||
/** | ||
* Log the exception in the js console. | ||
*/ | ||
|
||
CustomException.prototype.log = function log() { | ||
console.error('name', this.name, 'message', this.message, 'options', this.options); | ||
}; | ||
|
||
/** | ||
* Jsonify the exception. | ||
* @return {object} - The json exception. | ||
*/ | ||
|
||
CustomException.prototype.toJSON = function toJSON() { | ||
var name = this.name; | ||
var message = this.message; | ||
var options = this.options; | ||
|
||
return { name: name, message: message, options: options }; | ||
}; | ||
|
||
_createClass(CustomException, [{ | ||
key: 'name', | ||
get: function get() { | ||
return this.constructor.name; | ||
} | ||
}]); | ||
|
||
return CustomException; | ||
})(Error); | ||
|
||
module.exports = CustomException; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
|
||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
|
||
var CustomException = require('./custom-exception'); | ||
/** | ||
* Class standing for the NotImplemented exceptions. | ||
*/ | ||
|
||
var DependencyException = (function (_CustomException) { | ||
_inherits(DependencyException, _CustomException); | ||
|
||
/** | ||
* Exception constructor.. | ||
* @param message {string} - Exception message. | ||
* @param options {object} - Object to add to the exception. | ||
*/ | ||
|
||
function DependencyException(message, options) { | ||
_classCallCheck(this, DependencyException); | ||
|
||
_CustomException.call(this, 'DependencyException', message, options); | ||
} | ||
|
||
return DependencyException; | ||
})(CustomException); | ||
|
||
module.exports = DependencyException; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
|
||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
|
||
var CustomException = require('./custom-exception'); | ||
/** | ||
* Class standing for the FocusException exceptions. | ||
*/ | ||
|
||
var FocusException = (function (_CustomException) { | ||
_inherits(FocusException, _CustomException); | ||
|
||
/** | ||
* Exception constructor.. | ||
* @param messgae {string} - Exception message. | ||
* @param options {object} - Object to add to the exception. | ||
*/ | ||
|
||
function FocusException(message, options) { | ||
_classCallCheck(this, FocusException); | ||
|
||
_CustomException.call(this, 'FocusException', message, options); | ||
} | ||
|
||
return FocusException; | ||
})(CustomException); | ||
|
||
module.exports = FocusException; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
|
||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
|
||
var CustomException = require('./custom-exception'); | ||
/** | ||
* Class standing for the NotImplemented exceptions. | ||
*/ | ||
|
||
var NotImplementedException = (function (_CustomException) { | ||
_inherits(NotImplementedException, _CustomException); | ||
|
||
/** | ||
* Exception constructor. | ||
* @param message {string} - Exception message. | ||
* @param options {object} - Object to add to the exception. | ||
*/ | ||
|
||
function NotImplementedException(message, options) { | ||
_classCallCheck(this, NotImplementedException); | ||
|
||
_CustomException.call(this, 'NotImplementedException', message, options); | ||
} | ||
|
||
return NotImplementedException; | ||
})(CustomException); | ||
|
||
module.exports = NotImplementedException; |