From 345ecc739ab145f9a0e7c27bbcb4ee72ccd3a86b Mon Sep 17 00:00:00 2001 From: Roger Meier Date: Wed, 3 Aug 2011 09:49:27 +0000 Subject: [PATCH] THRIFT-690 add new ApplicationExceptions (INTERNAL_ERROR, PROTOCOL_ERROR) to the following languages: as3, c_glib, cocoa, cpp, erl, hs, js, nodejs, ocaml, perl, py, rb git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1153412 13f79535-47bb-0310-9956-ffa450edef68 --- lib/as3/src/org/apache/thrift/TApplicationError.as | 1 + lib/c_glib/src/thrift_application_exception.h | 4 +++- lib/cocoa/src/TApplicationException.h | 4 +++- lib/cpp/src/TApplicationException.h | 4 +++- lib/erl/include/thrift_constants.hrl | 2 ++ lib/hs/src/Thrift.hs | 6 ++++++ lib/js/thrift.js | 4 +++- lib/nodejs/lib/thrift/thrift.js | 4 +++- lib/ocaml/src/Thrift.ml | 6 ++++++ lib/perl/lib/Thrift.pm | 2 ++ lib/py/src/Thrift.py | 2 ++ lib/rb/lib/thrift/exceptions.rb | 4 +++- 12 files changed, 37 insertions(+), 6 deletions(-) diff --git a/lib/as3/src/org/apache/thrift/TApplicationError.as b/lib/as3/src/org/apache/thrift/TApplicationError.as index 93ef946d..aa3278df 100644 --- a/lib/as3/src/org/apache/thrift/TApplicationError.as +++ b/lib/as3/src/org/apache/thrift/TApplicationError.as @@ -41,6 +41,7 @@ package org.apache.thrift { public static const BAD_SEQUENCE_ID:int = 4; public static const MISSING_RESULT:int = 5; public static const INTERNAL_ERROR:int = 6; + public static const PROTOCOL_ERROR:int = 7; public function TApplicationError(type:int = UNKNOWN, message:String = "") { super(message, type); diff --git a/lib/c_glib/src/thrift_application_exception.h b/lib/c_glib/src/thrift_application_exception.h index 369c29bd..be5a8c0e 100644 --- a/lib/c_glib/src/thrift_application_exception.h +++ b/lib/c_glib/src/thrift_application_exception.h @@ -65,7 +65,9 @@ typedef enum THRIFT_APPLICATION_EXCEPTION_ERROR_INVALID_MESSAGE_TYPE, THRIFT_APPLICATION_EXCEPTION_ERROR_WRONG_METHOD_NAME, THRIFT_APPLICATION_EXCEPTION_ERROR_BAD_SEQUENCE_ID, - THRIFT_APPLICATION_EXCEPTION_ERROR_MISSING_RESULT + THRIFT_APPLICATION_EXCEPTION_ERROR_MISSING_RESULT, + THRIFT_APPLICATION_EXCEPTION_ERROR_INTERNAL_ERROR, + THRIFT_APPLICATION_EXCEPTION_ERROR_PROTOCOL_ERROR } ThriftApplicationExceptionError; /* define error domain for GError */ diff --git a/lib/cocoa/src/TApplicationException.h b/lib/cocoa/src/TApplicationException.h index cf1641d9..0ad0b9ad 100644 --- a/lib/cocoa/src/TApplicationException.h +++ b/lib/cocoa/src/TApplicationException.h @@ -26,7 +26,9 @@ enum { TApplicationException_INVALID_MESSAGE_TYPE = 2, TApplicationException_WRONG_METHOD_NAME = 3, TApplicationException_BAD_SEQUENCE_ID = 4, - TApplicationException_MISSING_RESULT = 5 + TApplicationException_MISSING_RESULT = 5, + TApplicationException_INTERNAL_ERROR = 6, + TApplicationException_PROTOCOL_ERROR = 7 }; // FIXME diff --git a/lib/cpp/src/TApplicationException.h b/lib/cpp/src/TApplicationException.h index e125c523..61e68644 100644 --- a/lib/cpp/src/TApplicationException.h +++ b/lib/cpp/src/TApplicationException.h @@ -41,7 +41,9 @@ class TApplicationException : public TException { INVALID_MESSAGE_TYPE = 2, WRONG_METHOD_NAME = 3, BAD_SEQUENCE_ID = 4, - MISSING_RESULT = 5 + MISSING_RESULT = 5, + INTERNAL_ERROR = 6, + PROTOCOL_ERROR = 7 }; TApplicationException() : diff --git a/lib/erl/include/thrift_constants.hrl b/lib/erl/include/thrift_constants.hrl index 36eb49bf..61d8e1a9 100644 --- a/lib/erl/include/thrift_constants.hrl +++ b/lib/erl/include/thrift_constants.hrl @@ -51,4 +51,6 @@ -define(TApplicationException_WRONG_METHOD_NAME, 3). -define(TApplicationException_BAD_SEQUENCE_ID, 4). -define(TApplicationException_MISSING_RESULT, 5). +-define(TApplicationException_INTERNAL_ERROR, 6). +-define(TApplicationException_PROTOCOL_ERROR, 7). diff --git a/lib/hs/src/Thrift.hs b/lib/hs/src/Thrift.hs index 9b4d41e9..e57cff58 100644 --- a/lib/hs/src/Thrift.hs +++ b/lib/hs/src/Thrift.hs @@ -50,6 +50,8 @@ data AppExnType | AE_WRONG_METHOD_NAME | AE_BAD_SEQUENCE_ID | AE_MISSING_RESULT + | AE_INTERNAL_ERROR + | AE_PROTOCOL_ERROR deriving ( Eq, Show, Typeable ) instance Enum AppExnType where @@ -59,6 +61,8 @@ instance Enum AppExnType where toEnum 3 = AE_WRONG_METHOD_NAME toEnum 4 = AE_BAD_SEQUENCE_ID toEnum 5 = AE_MISSING_RESULT + toEnum 6 = AE_INTERNAL_ERROR + toEnum 7 = AE_PROTOCOL_ERROR toEnum t = error $ "Invalid AppExnType " ++ show t fromEnum AE_UNKNOWN = 0 @@ -67,6 +71,8 @@ instance Enum AppExnType where fromEnum AE_WRONG_METHOD_NAME = 3 fromEnum AE_BAD_SEQUENCE_ID = 4 fromEnum AE_MISSING_RESULT = 5 + fromEnum AE_INTERNAL_ERROR = 6 + fromEnum AE_PROTOCOL_ERROR = 7 data AppExn = AppExn { ae_type :: AppExnType, ae_message :: String } deriving ( Show, Typeable ) diff --git a/lib/js/thrift.js b/lib/js/thrift.js index 860cb99c..91c44666 100644 --- a/lib/js/thrift.js +++ b/lib/js/thrift.js @@ -85,7 +85,9 @@ Thrift.TApplicationExceptionType = { 'INVALID_MESSAGE_TYPE' : 2, 'WRONG_METHOD_NAME' : 3, 'BAD_SEQUENCE_ID' : 4, - 'MISSING_RESULT' : 5 + 'MISSING_RESULT' : 5, + 'INTERNAL_ERROR' : 6, + 'PROTOCOL_ERROR' : 7 }; Thrift.TApplicationException = function(message, code) { diff --git a/lib/nodejs/lib/thrift/thrift.js b/lib/nodejs/lib/thrift/thrift.js index 53ca1066..a079001a 100644 --- a/lib/nodejs/lib/thrift/thrift.js +++ b/lib/nodejs/lib/thrift/thrift.js @@ -57,7 +57,9 @@ var TApplicationExceptionType = exports.TApplicationExceptionType = { INVALID_MESSAGE_TYPE: 2, WRONG_METHOD_NAME: 3, BAD_SEQUENCE_ID: 4, - MISSING_RESULT: 5 + MISSING_RESULT: 5, + INTERNAL_ERROR: 6, + PROTOCOL_ERROR: 7 } var TApplicationException = exports.TApplicationException = function(type, message) { diff --git a/lib/ocaml/src/Thrift.ml b/lib/ocaml/src/Thrift.ml index fdf2649f..bc2d2c3e 100644 --- a/lib/ocaml/src/Thrift.ml +++ b/lib/ocaml/src/Thrift.ml @@ -292,6 +292,8 @@ struct | WRONG_METHOD_NAME | BAD_SEQUENCE_ID | MISSING_RESULT + | INTERNAL_ERROR + | PROTOCOL_ERROR let typ_of_i = function 0l -> UNKNOWN @@ -300,6 +302,8 @@ struct | 3l -> WRONG_METHOD_NAME | 4l -> BAD_SEQUENCE_ID | 5l -> MISSING_RESULT + | 61 -> INTERNAL_ERROR + | 71 -> PROTOCOL_ERROR | _ -> raise Thrift_error;; let typ_to_i = function | UNKNOWN -> 0l @@ -308,6 +312,8 @@ struct | WRONG_METHOD_NAME -> 3l | BAD_SEQUENCE_ID -> 4l | MISSING_RESULT -> 5l + | INTERNAL_ERROR -> 61 + | PROTOCOL_ERROR -> 71 class t = object (self) diff --git a/lib/perl/lib/Thrift.pm b/lib/perl/lib/Thrift.pm index ffd6aeec..3155714e 100644 --- a/lib/perl/lib/Thrift.pm +++ b/lib/perl/lib/Thrift.pm @@ -75,6 +75,8 @@ use constant INVALID_MESSAGE_TYPE => 2; use constant WRONG_METHOD_NAME => 3; use constant BAD_SEQUENCE_ID => 4; use constant MISSING_RESULT => 5; +use constant INTERNAL_ERROR => 6; +use constant PROTOCOL_ERROR => 7; sub new { my $classname = shift; diff --git a/lib/py/src/Thrift.py b/lib/py/src/Thrift.py index 91728a77..af6f58da 100644 --- a/lib/py/src/Thrift.py +++ b/lib/py/src/Thrift.py @@ -77,6 +77,8 @@ class TApplicationException(TException): WRONG_METHOD_NAME = 3 BAD_SEQUENCE_ID = 4 MISSING_RESULT = 5 + INTERNAL_ERROR = 6 + PROTOCOL_ERROR = 7 def __init__(self, type=UNKNOWN, message=None): TException.__init__(self, message) diff --git a/lib/rb/lib/thrift/exceptions.rb b/lib/rb/lib/thrift/exceptions.rb index dda70894..2ccc7ce6 100644 --- a/lib/rb/lib/thrift/exceptions.rb +++ b/lib/rb/lib/thrift/exceptions.rb @@ -35,6 +35,8 @@ module Thrift WRONG_METHOD_NAME = 3 BAD_SEQUENCE_ID = 4 MISSING_RESULT = 5 + INTERNAL_ERROR = 6 + PROTOCOL_ERROR = 7 attr_reader :type @@ -79,4 +81,4 @@ module Thrift end end -end \ No newline at end of file +end -- 2.17.1