#402: Don't fail if captureStackTrace is not a function (#410)

This commit is contained in:
Jeff Alder
2017-10-09 19:28:37 +02:00
committed by Eduardo Diaz
parent a5e0c09c2d
commit b00c459bc6
+4 -2
View File
@@ -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;
module.exports = JsonWebTokenError;