diff --git a/lib/JsonWebTokenError.js b/lib/JsonWebTokenError.js index 7c4ea0f..e068222 100644 --- a/lib/JsonWebTokenError.js +++ b/lib/JsonWebTokenError.js @@ -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; @@ -9,4 +11,4 @@ var JsonWebTokenError = function (message, error) { JsonWebTokenError.prototype = Object.create(Error.prototype); JsonWebTokenError.prototype.constructor = JsonWebTokenError; -module.exports = JsonWebTokenError; \ No newline at end of file +module.exports = JsonWebTokenError;