THRIFT-2963: repairs bad error refs and exceptions
Client: Nodejs
Patch: Tom Croucher
Repairs various error code blocks in nodejs TCompactProtocol
diff --git a/lib/nodejs/lib/thrift/protocol.js b/lib/nodejs/lib/thrift/protocol.js
index 8e0dbd1..6c8e8e6 100644
--- a/lib/nodejs/lib/thrift/protocol.js
+++ b/lib/nodejs/lib/thrift/protocol.js
@@ -546,7 +546,7 @@
case TCompactProtocol.Types.CT_STRUCT:
return Type.STRUCT;
default:
- throw new Thrift.TProtocolException(Thift.TProtocolExceptionType.INVALID_DATA, "Unknown type: " + type);
+ throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.INVALID_DATA, "Unknown type: " + type);
}
return Type.STOP;
};
@@ -827,7 +827,7 @@
n = new Int64(n);
}
if (! (n instanceof Int64)) {
- throw new TProtocolException(INVALID_DATA, "Expected Int64 or Number, found: " + n);
+ throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.INVALID_DATA, "Expected Int64 or Number, found: " + n);
}
var buf = new Buffer(10);
@@ -890,14 +890,14 @@
//Read protocol ID
var protocolId = this.trans.readByte();
if (protocolId != TCompactProtocol.PROTOCOL_ID) {
- throw new TProtocolException(BAD_VERSION, "Bad protocol identifier " + protocolId);
+ throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.BAD_VERSION, "Bad protocol identifier " + protocolId);
}
//Read Version and Type
var versionAndType = this.trans.readByte();
var version = (versionAndType & TCompactProtocol.VERSION_MASK);
if (version != TCompactProtocol.VERSION_N) {
- throw new TProtocolException(BAD_VERSION, "Bad protocol version " + version);
+ throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.BAD_VERSION, "Bad protocol version " + version);
}
var type = ((versionAndType >> TCompactProtocol.TYPE_SHIFT_AMOUNT) & TCompactProtocol.TYPE_BITS);