This is an automated email from the ASF dual-hosted git repository.
jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git
The following commit(s) were added to refs/heads/master by this push:
new dfd6df7 THRIFT-3356: handle undefined captureStackTrace Client:
nodejs Patch: Márton Csordás
dfd6df7 is described below
commit dfd6df7588564739be7a1eba8a7c3ed83ee27a4b
Author: Márton Csordás <[email protected]>
AuthorDate: Thu Apr 2 12:23:22 2020 +0200
THRIFT-3356: handle undefined captureStackTrace
Client: nodejs
Patch: Márton Csordás
This closes #2082
---
lib/js/src/thrift.js | 5 ++++-
lib/nodejs/lib/thrift/header_protocol.js | 5 ++++-
lib/nodejs/lib/thrift/header_transport.js | 5 ++++-
lib/nodejs/lib/thrift/http_connection.js | 5 ++++-
lib/nodejs/lib/thrift/input_buffer_underrun_error.js | 5 ++++-
lib/nodejs/lib/thrift/thrift.js | 15 ++++++++++++---
6 files changed, 32 insertions(+), 8 deletions(-)
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.TProtocolExceptionType = {
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;
diff --git a/lib/nodejs/lib/thrift/header_protocol.js
b/lib/nodejs/lib/thrift/header_protocol.js
index 0c3b0db..a037dc2 100644
--- a/lib/nodejs/lib/thrift/header_protocol.js
+++ b/lib/nodejs/lib/thrift/header_protocol.js
@@ -29,7 +29,10 @@ module.exports = THeaderProtocol;
function THeaderProtocolError(message) {
Error.call(this);
- Error.captureStackTrace(this, this.constructor);
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, this.constructor);
+ }
+
this.name = this.constructor.name;
this.message = message;
}
diff --git a/lib/nodejs/lib/thrift/header_transport.js
b/lib/nodejs/lib/thrift/header_transport.js
index c5f133e..252a423 100644
--- a/lib/nodejs/lib/thrift/header_transport.js
+++ b/lib/nodejs/lib/thrift/header_transport.js
@@ -24,7 +24,10 @@ var InputBufferUnderrunError =
require('./input_buffer_underrun_error');
function THeaderTransportError(message) {
Error.call(this);
- Error.captureStackTrace(this, this.constructor);
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, this.constructor);
+ }
+
this.name = this.constructor.name;
this.message = message;
}
diff --git a/lib/nodejs/lib/thrift/http_connection.js
b/lib/nodejs/lib/thrift/http_connection.js
index 3c2ab0f..81e6b70 100644
--- a/lib/nodejs/lib/thrift/http_connection.js
+++ b/lib/nodejs/lib/thrift/http_connection.js
@@ -253,7 +253,10 @@ exports.createHttpClient = createClient
function THTTPException(response) {
thrift.TApplicationException.call(this);
- Error.captureStackTrace(this, this.constructor);
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, this.constructor);
+ }
+
this.name = this.constructor.name;
this.statusCode = response.statusCode;
this.response = response;
diff --git a/lib/nodejs/lib/thrift/input_buffer_underrun_error.js
b/lib/nodejs/lib/thrift/input_buffer_underrun_error.js
index 72555e5..0e33f5a 100644
--- a/lib/nodejs/lib/thrift/input_buffer_underrun_error.js
+++ b/lib/nodejs/lib/thrift/input_buffer_underrun_error.js
@@ -22,7 +22,10 @@ module.exports = InputBufferUnderrunError;
function InputBufferUnderrunError(message) {
Error.call(this);
- Error.captureStackTrace(this, this.constructor);
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, this.constructor);
+ }
+
this.name = this.constructor.name;
this.message = message;
};
diff --git a/lib/nodejs/lib/thrift/thrift.js b/lib/nodejs/lib/thrift/thrift.js
index f2b2896..58d4aff 100644
--- a/lib/nodejs/lib/thrift/thrift.js
+++ b/lib/nodejs/lib/thrift/thrift.js
@@ -49,7 +49,10 @@ exports.TException = TException;
function TException(message) {
Error.call(this);
- Error.captureStackTrace(this, this.constructor);
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, this.constructor);
+ }
+
this.name = this.constructor.name;
this.message = message;
};
@@ -73,7 +76,10 @@ exports.TApplicationException = TApplicationException;
function TApplicationException(type, message) {
TException.call(this);
- Error.captureStackTrace(this, this.constructor);
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, this.constructor);
+ }
+
this.type = type || TApplicationExceptionType.UNKNOWN;
this.name = this.constructor.name;
this.message = message;
@@ -149,7 +155,10 @@ exports.TProtocolException = 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;