THRIFT-3356: handle undefined captureStackTrace
Client: nodejs
Patch: Márton Csordás
This closes #2082
diff --git a/lib/js/src/thrift.js b/lib/js/src/thrift.js
index 69bcccd..c682605 100644
--- a/lib/js/src/thrift.js
+++ b/lib/js/src/thrift.js
@@ -284,7 +284,10 @@
Thrift.TProtocolException = function TProtocolException(type, message) {
Error.call(this);
- Error.captureStackTrace(this, this.constructor);
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, this.constructor);
+ }
+
this.name = this.constructor.name;
this.type = type;
this.message = message;