Skip to content

Commit

Permalink
#402: Don't fail if captureStackTrace is not a function (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
aldermoovel authored and ziluvatar committed Oct 9, 2017
1 parent d3f996b commit 77ee965
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/JsonWebTokenError.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
var JsonWebTokenError = function (message, error) {
Error.call(this, message);
Error.captureStackTrace(this, this.constructor);
if(Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
this.name = 'JsonWebTokenError';
this.message = message;
if (error) this.inner = error;
Expand All @@ -9,4 +11,4 @@ var JsonWebTokenError = function (message, error) {
JsonWebTokenError.prototype = Object.create(Error.prototype);
JsonWebTokenError.prototype.constructor = JsonWebTokenError;

module.exports = JsonWebTokenError;
module.exports = JsonWebTokenError;

0 comments on commit 77ee965

Please sign in to comment.