protect against lack of Error.captureStackTrace (#138)
diff --git a/lib/openwhisk_error.js b/lib/openwhisk_error.js
index 6780726..1bc68f6 100644
--- a/lib/openwhisk_error.js
+++ b/lib/openwhisk_error.js
@@ -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