THRIFT-690 add new ApplicationExceptions (INTERNAL_ERROR, PROTOCOL_ERROR) to the...
authorRoger Meier <roger@apache.org>
Wed, 3 Aug 2011 09:49:27 +0000 (09:49 +0000)
committerRoger Meier <roger@apache.org>
Wed, 3 Aug 2011 09:49:27 +0000 (09:49 +0000)
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1153412 13f79535-47bb-0310-9956-ffa450edef68

12 files changed:
lib/as3/src/org/apache/thrift/TApplicationError.as
lib/c_glib/src/thrift_application_exception.h
lib/cocoa/src/TApplicationException.h
lib/cpp/src/TApplicationException.h
lib/erl/include/thrift_constants.hrl
lib/hs/src/Thrift.hs
lib/js/thrift.js
lib/nodejs/lib/thrift/thrift.js
lib/ocaml/src/Thrift.ml
lib/perl/lib/Thrift.pm
lib/py/src/Thrift.py
lib/rb/lib/thrift/exceptions.rb

index 93ef946..aa3278d 100644 (file)
@@ -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);
index 369c29b..be5a8c0 100644 (file)
@@ -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 */
index cf1641d..0ad0b9a 100644 (file)
@@ -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
index e125c52..61e6864 100644 (file)
@@ -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() :
index 36eb49b..61d8e1a 100644 (file)
@@ -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).
 
index 9b4d41e..e57cff5 100644 (file)
@@ -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 )
index 860cb99..91c4466 100644 (file)
@@ -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) {
index 53ca106..a079001 100644 (file)
@@ -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) {
index fdf2649..bc2d2c3 100644 (file)
@@ -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)
index ffd6aee..3155714 100644 (file)
@@ -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;
index 91728a7..af6f58d 100644 (file)
@@ -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)
index dda7089..2ccc7ce 100644 (file)
@@ -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