protect against lack of Error.captureStackTrace (#138)
authorNick Mitchell <starpit@users.noreply.github.com>
Thu, 13 Sep 2018 07:41:17 +0000 (03:41 -0400)
committerJames Thomas <jthomas.uk@gmail.com>
Thu, 13 Sep 2018 07:41:17 +0000 (09:41 +0200)
lib/openwhisk_error.js

index 6780726..1bc68f6 100644 (file)
@@ -4,7 +4,10 @@
 'use strict'
 
 module.exports = function OpenWhiskError (message, error, statusCode) {
-  Error.captureStackTrace(this, this.constructor)
+  if (Error.captureStackTrace) {
+    // this function is not defined in some browsers, notably Firefox
+    Error.captureStackTrace(this, this.constructor)
+  }
   this.name = this.constructor.name
   this.message = message
   this.error = error