THRIFT-3926: Fix undeclared statusCode variable (#1531)
Client: nodejs
diff --git a/lib/nodejs/lib/thrift/http_connection.js b/lib/nodejs/lib/thrift/http_connection.js
index 4f5378f..3c2ab0f 100644
--- a/lib/nodejs/lib/thrift/http_connection.js
+++ b/lib/nodejs/lib/thrift/http_connection.js
@@ -170,7 +170,7 @@
var dataLen = 0;
if (response.statusCode !== 200) {
- this.emit("error", new THTTPException(statusCode, response));
+ this.emit("error", new THTTPException(response));
}
response.on('error', function (e) {
@@ -251,11 +251,11 @@
exports.createHttpClient = createClient
-function THTTPException(statusCode, response) {
+function THTTPException(response) {
thrift.TApplicationException.call(this);
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
- this.statusCode = statusCode;
+ this.statusCode = response.statusCode;
this.response = response;
this.type = thrift.TApplicationExceptionType.PROTOCOL_ERROR;
this.message = "Received a response with a bad HTTP status code: " + response.statusCode;