Skip to content

Commit

Permalink
[release]
Browse files Browse the repository at this point in the history
  • Loading branch information
pierr committed Aug 26, 2015
1 parent e0fa35e commit 9c08743
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 0 deletions.
30 changes: 30 additions & 0 deletions lib/exception/argument-invalid-exception.js
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;
30 changes: 30 additions & 0 deletions lib/exception/argument-null-exception.js
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;
64 changes: 64 additions & 0 deletions lib/exception/custom-exception.js
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;
30 changes: 30 additions & 0 deletions lib/exception/dependency-exception.js
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;
30 changes: 30 additions & 0 deletions lib/exception/focus-exception.js
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;
30 changes: 30 additions & 0 deletions lib/exception/not-implemented-exception.js
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;

0 comments on commit 9c08743

Please sign in to comment.