THRIFT-3714 Define TProtocolException in js/src/thrift.js
This closes #926
diff --git a/lib/js/src/thrift.js b/lib/js/src/thrift.js
index 34be450..c846162 100644
--- a/lib/js/src/thrift.js
+++ b/lib/js/src/thrift.js
@@ -272,6 +272,25 @@
return this.code;
};
+Thrift.TProtocolExceptionType = {
+ UNKNOWN: 0,
+ INVALID_DATA: 1,
+ NEGATIVE_SIZE: 2,
+ SIZE_LIMIT: 3,
+ BAD_VERSION: 4,
+ NOT_IMPLEMENTED: 5,
+ DEPTH_LIMIT: 6
+};
+
+Thrift.TProtocolException = function TProtocolException(type, message) {
+ Error.call(this);
+ Error.captureStackTrace(this, this.constructor);
+ this.name = this.constructor.name;
+ this.type = type;
+ this.message = message;
+};
+Thrift.inherits(Thrift.TProtocolException, Thrift.TException, 'TProtocolException');
+
/**
* Constructor Function for the XHR transport.
* If you do not specify a url then you must handle XHR operations on