Skip to content

Commit

Permalink
Merge branch 'lpinca-fix/error-stack'
Browse files Browse the repository at this point in the history
* lpinca-fix/error-stack:
  Create a `.stack` property on `FigoError` object.
  • Loading branch information
mfilenko committed Aug 23, 2016
2 parents 3136901 + 7f19f17 commit d8d8ab7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
// - **error_description** (`String`) - the error description
//
var FigoError = function(error, error_description, errno) {
Error.captureStackTrace(this, FigoError);

this.name = 'FigoError';
this.error = error;
this.error_description = error_description;
this.message = this.error_description = error_description;
this.errno = errno;
this.stack = (new Error()).stack;
};
FigoError.prototype = Object.create(Error.prototype);
FigoError.prototype.constructor = FigoError;
Expand All @@ -20,5 +21,5 @@ FigoError.prototype.toString = function() {
};

module.exports = {
FigoError: FigoError
FigoError: FigoError
};

0 comments on commit d8d8ab7

Please sign in to comment.