THRIFT-1801 Sync up TApplicationException codes across languages and thrift implementations
Patch: Andrew Cox
diff --git a/lib/as3/src/org/apache/thrift/TApplicationError.as b/lib/as3/src/org/apache/thrift/TApplicationError.as
index aa3278d..3448fce 100644
--- a/lib/as3/src/org/apache/thrift/TApplicationError.as
+++ b/lib/as3/src/org/apache/thrift/TApplicationError.as
@@ -42,11 +42,14 @@
public static const MISSING_RESULT:int = 5;
public static const INTERNAL_ERROR:int = 6;
public static const PROTOCOL_ERROR:int = 7;
+ public static const INVALID_TRANSFORM:int = 8;
+ public static const INVALID_PROTOCOL:int = 9;
+ public static const UNSUPPORTED_CLIENT_TYPE:int = 10;
public function TApplicationError(type:int = UNKNOWN, message:String = "") {
super(message, type);
}
-
+
public static function read(iprot:TProtocol):TApplicationError {
var field:TField;
iprot.readStructBegin();
diff --git a/lib/c_glib/src/thrift/thrift_application_exception.h b/lib/c_glib/src/thrift/thrift_application_exception.h
index be5a8c0..580f4fc 100644
--- a/lib/c_glib/src/thrift/thrift_application_exception.h
+++ b/lib/c_glib/src/thrift/thrift_application_exception.h
@@ -67,7 +67,10 @@
THRIFT_APPLICATION_EXCEPTION_ERROR_BAD_SEQUENCE_ID,
THRIFT_APPLICATION_EXCEPTION_ERROR_MISSING_RESULT,
THRIFT_APPLICATION_EXCEPTION_ERROR_INTERNAL_ERROR,
- THRIFT_APPLICATION_EXCEPTION_ERROR_PROTOCOL_ERROR
+ THRIFT_APPLICATION_EXCEPTION_ERROR_PROTOCOL_ERROR,
+ THRIFT_APPLICATION_EXCEPTION_ERROR_INVALID_TRANSFORM,
+ THRIFT_APPLICATION_EXCEPTION_ERROR_INVALID_PROTOCOL,
+ THRIFT_APPLICATION_EXCEPTION_ERROR_UNSUPPORTED_CLIENT_TYPE
} ThriftApplicationExceptionError;
/* define error domain for GError */
diff --git a/lib/cocoa/src/TApplicationException.h b/lib/cocoa/src/TApplicationException.h
index 0ad0b9a..7b027d6 100644
--- a/lib/cocoa/src/TApplicationException.h
+++ b/lib/cocoa/src/TApplicationException.h
@@ -28,7 +28,10 @@
TApplicationException_BAD_SEQUENCE_ID = 4,
TApplicationException_MISSING_RESULT = 5,
TApplicationException_INTERNAL_ERROR = 6,
- TApplicationException_PROTOCOL_ERROR = 7
+ TApplicationException_PROTOCOL_ERROR = 7,
+ TApplicationException_INVALID_TRANSFORM = 8,
+ TApplicationException_INVALID_PROTOCOL = 9,
+ TApplicationException_UNSUPPORTED_CLIENT_TYPE = 10
};
// FIXME
diff --git a/lib/cocoa/src/TApplicationException.m b/lib/cocoa/src/TApplicationException.m
index 66c2f2b..974dfc5 100644
--- a/lib/cocoa/src/TApplicationException.m
+++ b/lib/cocoa/src/TApplicationException.m
@@ -45,6 +45,21 @@
case TApplicationException_MISSING_RESULT:
name = @"Missing result";
break;
+ case TApplicationException_INTERNAL_ERROR:
+ name = @"Internal error";
+ break;
+ case TApplicationException_PROTOCOL_ERROR:
+ name = @"Protocol error";
+ break;
+ case TApplicationException_INVALID_TRANSFORM:
+ name = @"Invalid transform";
+ break;
+ case TApplicationException_INVALID_PROTOCOL:
+ name = @"Invalid protocol";
+ break;
+ case TApplicationException_UNSUPPORTED_CLIENT_TYPE:
+ name = @"Unsupported client type";
+ break;
default:
name = @"Unknown";
break;
diff --git a/lib/cpp/src/thrift/TApplicationException.h b/lib/cpp/src/thrift/TApplicationException.h
index 79f026d..d32a21d 100644
--- a/lib/cpp/src/thrift/TApplicationException.h
+++ b/lib/cpp/src/thrift/TApplicationException.h
@@ -43,7 +43,10 @@
BAD_SEQUENCE_ID = 4,
MISSING_RESULT = 5,
INTERNAL_ERROR = 6,
- PROTOCOL_ERROR = 7
+ PROTOCOL_ERROR = 7,
+ INVALID_TRANSFORM = 8,
+ INVALID_PROTOCOL = 9,
+ UNSUPPORTED_CLIENT_TYPE = 10
};
TApplicationException() :
@@ -78,13 +81,18 @@
virtual const char* what() const throw() {
if (message_.empty()) {
switch (type_) {
- case UNKNOWN : return "TApplicationException: Unknown application exception";
- case UNKNOWN_METHOD : return "TApplicationException: Unknown method";
- case INVALID_MESSAGE_TYPE : return "TApplicationException: Invalid message type";
- case WRONG_METHOD_NAME : return "TApplicationException: Wrong method name";
- case BAD_SEQUENCE_ID : return "TApplicationException: Bad sequence identifier";
- case MISSING_RESULT : return "TApplicationException: Missing result";
- default : return "TApplicationException: (Invalid exception type)";
+ case UNKNOWN : return "TApplicationException: Unknown application exception";
+ case UNKNOWN_METHOD : return "TApplicationException: Unknown method";
+ case INVALID_MESSAGE_TYPE : return "TApplicationException: Invalid message type";
+ case WRONG_METHOD_NAME : return "TApplicationException: Wrong method name";
+ case BAD_SEQUENCE_ID : return "TApplicationException: Bad sequence identifier";
+ case MISSING_RESULT : return "TApplicationException: Missing result";
+ case INTERNAL_ERROR : return "TApplicationException: Internal error";
+ case PROTOCOL_ERROR : return "TApplicationException: Protocol error";
+ case INVALID_TRANSFORM : return "TApplicationException: Invalid transform";
+ case INVALID_PROTOCOL : return "TApplicationException: Invalid protocol";
+ case UNSUPPORTED_CLIENT_TYPE : return "TApplicationException: Unsupported client type";
+ default : return "TApplicationException: (Invalid exception type)";
};
} else {
return message_.c_str();
diff --git a/lib/csharp/src/TApplicationException.cs b/lib/csharp/src/TApplicationException.cs
index 57dd375..9aaf6f7 100644
--- a/lib/csharp/src/TApplicationException.cs
+++ b/lib/csharp/src/TApplicationException.cs
@@ -130,7 +130,12 @@
InvalidMessageType,
WrongMethodName,
BadSequenceID,
- MissingResult
+ MissingResult,
+ InternalError,
+ ProtocolError,
+ InvalidTransform,
+ InvalidProtocol,
+ UnsupportedClientType
}
}
}
diff --git a/lib/d/src/thrift/protocol/base.d b/lib/d/src/thrift/protocol/base.d
index 97cbb4d..bd65b71 100644
--- a/lib/d/src/thrift/protocol/base.d
+++ b/lib/d/src/thrift/protocol/base.d
@@ -345,7 +345,10 @@
BAD_SEQUENCE_ID = 4, ///
MISSING_RESULT = 5, ///
INTERNAL_ERROR = 6, ///
- PROTOCOL_ERROR = 7 ///
+ PROTOCOL_ERROR = 7, ///
+ INVALID_TRANSFORM = 8, ///
+ INVALID_PROTOCOL = 9, ///
+ UNSUPPORTED_CLIENT_TYPE = 10 ///
}
///
@@ -358,6 +361,11 @@
case Type.WRONG_METHOD_NAME: return "Wrong method name";
case Type.BAD_SEQUENCE_ID: return "Bad sequence identifier";
case Type.MISSING_RESULT: return "Missing result";
+ case Type.INTERNAL_ERROR: return "Internal error";
+ case Type.PROTOCOL_ERROR: return "Protocol error";
+ case Type.INVALID_TRANSFORM: return "Invalid transform";
+ case Type.INVALID_PROTOCOL: return "Invalid protocol";
+ case Type.UNSUPPORTED_CLIENT_TYPE: return "Unsupported client type";
default: return "(Invalid exception type)";
}
}
diff --git a/lib/delphi/src/Thrift.pas b/lib/delphi/src/Thrift.pas
index 189640a..44f12d7 100644
--- a/lib/delphi/src/Thrift.pas
+++ b/lib/delphi/src/Thrift.pas
@@ -43,7 +43,12 @@
InvalidMessageType,
WrongMethodName,
BadSequenceID,
- MissingResult
+ MissingResult,
+ InternalError,
+ ProtocolError,
+ InvalidTransform,
+ InvalidProtocol,
+ UnsupportedClientType
);
{$SCOPEDENUMS OFF}
private
diff --git a/lib/erl/include/thrift_constants.hrl b/lib/erl/include/thrift_constants.hrl
index 61d8e1a..dbfaaf6 100644
--- a/lib/erl/include/thrift_constants.hrl
+++ b/lib/erl/include/thrift_constants.hrl
@@ -53,4 +53,6 @@
-define(TApplicationException_MISSING_RESULT, 5).
-define(TApplicationException_INTERNAL_ERROR, 6).
-define(TApplicationException_PROTOCOL_ERROR, 7).
-
+-define(TApplicationException_INVALID_TRANSFORM, 8).
+-define(TApplicationException_INVALID_PROTOCOL, 9).
+-define(TApplicationException_UNSUPPORTED_CLIENT_TYPE, 10).
diff --git a/lib/go/thrift/tapplication_exception.go b/lib/go/thrift/tapplication_exception.go
index fc8bf2e..6b7a75d 100644
--- a/lib/go/thrift/tapplication_exception.go
+++ b/lib/go/thrift/tapplication_exception.go
@@ -32,6 +32,9 @@
MISSING_RESULT = 5
INTERNAL_ERROR = 6
PROTOCOL_ERROR = 7
+ INVALID_TRANSFORM = 8
+ INVALID_PROTOCOL = 9
+ UNSUPPORTED_CLIENT_TYPE = 10
)
diff --git a/lib/hs/src/Thrift.hs b/lib/hs/src/Thrift.hs
index 42f5d32..65a2208 100644
--- a/lib/hs/src/Thrift.hs
+++ b/lib/hs/src/Thrift.hs
@@ -54,6 +54,9 @@
| AE_MISSING_RESULT
| AE_INTERNAL_ERROR
| AE_PROTOCOL_ERROR
+ | AE_INVALID_TRANSFORM
+ | AE_INVALID_PROTOCOL
+ | AE_UNSUPPORTED_CLIENT_TYPE
deriving ( Eq, Show, Typeable )
instance Enum AppExnType where
@@ -65,6 +68,9 @@
toEnum 5 = AE_MISSING_RESULT
toEnum 6 = AE_INTERNAL_ERROR
toEnum 7 = AE_PROTOCOL_ERROR
+ toEnum 8 = AE_INVALID_TRANSFORM
+ toEnum 9 = AE_INVALID_PROTOCOL
+ toEnum 10 = AE_UNSUPPORTED_CLIENT_TYPE
toEnum t = error $ "Invalid AppExnType " ++ show t
fromEnum AE_UNKNOWN = 0
@@ -75,6 +81,9 @@
fromEnum AE_MISSING_RESULT = 5
fromEnum AE_INTERNAL_ERROR = 6
fromEnum AE_PROTOCOL_ERROR = 7
+ fromEnum AE_INVALID_TRANSFORM = 8
+ fromEnum AE_INVALID_PROTOCOL = 9
+ fromEnum AE_UNSUPPORTED_CLIENT_TYPE = 10
data AppExn = AppExn { ae_type :: AppExnType, ae_message :: String }
deriving ( Show, Typeable )
diff --git a/lib/java/src/org/apache/thrift/TApplicationException.java b/lib/java/src/org/apache/thrift/TApplicationException.java
index c294fc3..b54a5ce 100644
--- a/lib/java/src/org/apache/thrift/TApplicationException.java
+++ b/lib/java/src/org/apache/thrift/TApplicationException.java
@@ -45,6 +45,9 @@
public static final int MISSING_RESULT = 5;
public static final int INTERNAL_ERROR = 6;
public static final int PROTOCOL_ERROR = 7;
+ public static final int INVALID_TRANSFORM = 8;
+ public static final int INVALID_PROTOCOL = 9;
+ public static final int UNSUPPORTED_CLIENT_TYPE = 10;
protected int type_ = UNKNOWN;
diff --git a/lib/javame/src/org/apache/thrift/TApplicationException.java b/lib/javame/src/org/apache/thrift/TApplicationException.java
index de9a162..2f8612a 100644
--- a/lib/javame/src/org/apache/thrift/TApplicationException.java
+++ b/lib/javame/src/org/apache/thrift/TApplicationException.java
@@ -41,7 +41,9 @@
public static final int MISSING_RESULT = 5;
public static final int INTERNAL_ERROR = 6;
public static final int PROTOCOL_ERROR = 7;
-
+ public static final int INVALID_TRANSFORM = 8;
+ public static final int INVALID_PROTOCOL = 9;
+ public static final int UNSUPPORTED_CLIENT_TYPE = 10;
protected int type_ = UNKNOWN;
diff --git a/lib/js/thrift.js b/lib/js/thrift.js
index cf89236..39b0a5c 100644
--- a/lib/js/thrift.js
+++ b/lib/js/thrift.js
@@ -87,7 +87,10 @@
'BAD_SEQUENCE_ID' : 4,
'MISSING_RESULT' : 5,
'INTERNAL_ERROR' : 6,
- 'PROTOCOL_ERROR' : 7
+ 'PROTOCOL_ERROR' : 7,
+ 'INVALID_TRANSFORM' : 8,
+ 'INVALID_PROTOCOL' : 9,
+ 'UNSUPPORTED_CLIENT_TYPE' : 10
};
Thrift.TApplicationException = function(message, code) {
diff --git a/lib/nodejs/lib/thrift/thrift.js b/lib/nodejs/lib/thrift/thrift.js
index 6c500a5..94223e3 100644
--- a/lib/nodejs/lib/thrift/thrift.js
+++ b/lib/nodejs/lib/thrift/thrift.js
@@ -59,7 +59,10 @@
BAD_SEQUENCE_ID: 4,
MISSING_RESULT: 5,
INTERNAL_ERROR: 6,
- PROTOCOL_ERROR: 7
+ PROTOCOL_ERROR: 7,
+ INVALID_TRANSFORM: 8,
+ INVALID_PROTOCOL: 9,
+ UNSUPPORTED_CLIENT_TYPE: 10
}
var TApplicationException = exports.TApplicationException = function(type, message) {
diff --git a/lib/ocaml/src/Thrift.ml b/lib/ocaml/src/Thrift.ml
index 8d423d0..f176a43 100644
--- a/lib/ocaml/src/Thrift.ml
+++ b/lib/ocaml/src/Thrift.ml
@@ -294,6 +294,9 @@
| MISSING_RESULT
| INTERNAL_ERROR
| PROTOCOL_ERROR
+ | INVALID_TRANSFORM
+ | INVALID_PROTOCOL
+ | UNSUPPORTED_CLIENT_TYPE
let typ_of_i = function
0l -> UNKNOWN
@@ -304,6 +307,9 @@
| 5l -> MISSING_RESULT
| 6l -> INTERNAL_ERROR
| 7l -> PROTOCOL_ERROR
+ | 8l -> INVALID_TRANSFORM
+ | 9l -> INVALID_PROTOCOL
+ | 10l -> UNSUPPORTED_CLIENT_TYPE
| _ -> raise Thrift_error;;
let typ_to_i = function
| UNKNOWN -> 0l
@@ -314,6 +320,9 @@
| MISSING_RESULT -> 5l
| INTERNAL_ERROR -> 6l
| PROTOCOL_ERROR -> 7l
+ | INVALID_TRANSFORM -> 8l
+ | INVALID_PROTOCOL -> 9l
+ | UNSUPPORTED_CLIENT_TYPE -> 10l
class t =
object (self)
diff --git a/lib/perl/lib/Thrift.pm b/lib/perl/lib/Thrift.pm
index f526803..67186f2 100644
--- a/lib/perl/lib/Thrift.pm
+++ b/lib/perl/lib/Thrift.pm
@@ -69,14 +69,17 @@
package TApplicationException;
use base('Thrift::TException');
-use constant UNKNOWN => 0;
-use constant UNKNOWN_METHOD => 1;
-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;
+use constant UNKNOWN => 0;
+use constant UNKNOWN_METHOD => 1;
+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;
+use constant INVALID_TRANSFORM => 8;
+use constant INVALID_PROTOCOL => 9;
+use constant UNSUPPORTED_CLIENT_TYPE => 10;
sub new {
my $classname = shift;
diff --git a/lib/php/lib/Thrift/Exception/TApplicationException.php b/lib/php/lib/Thrift/Exception/TApplicationException.php
index 55d46e6..9081973 100644
--- a/lib/php/lib/Thrift/Exception/TApplicationException.php
+++ b/lib/php/lib/Thrift/Exception/TApplicationException.php
@@ -40,6 +40,9 @@
const MISSING_RESULT = 5;
const INTERNAL_ERROR = 6;
const PROTOCOL_ERROR = 7;
+ const INVALID_TRANSFORM = 8;
+ const INVALID_PROTOCOL = 9;
+ const UNSUPPORTED_CLIENT_TYPE = 10;
function __construct($message=null, $code=0) {
parent::__construct($message, $code);
diff --git a/lib/py/src/Thrift.py b/lib/py/src/Thrift.py
index 707a8cc..9890af7 100644
--- a/lib/py/src/Thrift.py
+++ b/lib/py/src/Thrift.py
@@ -101,6 +101,9 @@
MISSING_RESULT = 5
INTERNAL_ERROR = 6
PROTOCOL_ERROR = 7
+ INVALID_TRANSFORM = 8
+ INVALID_PROTOCOL = 9
+ UNSUPPORTED_CLIENT_TYPE = 10
def __init__(self, type=UNKNOWN, message=None):
TException.__init__(self, message)
@@ -119,6 +122,16 @@
return 'Bad sequence ID'
elif self.type == self.MISSING_RESULT:
return 'Missing result'
+ elif self.type == self.INTERNAL_ERROR:
+ return 'Internal error'
+ elif self.type == self.PROTOCOL_ERROR:
+ return 'Protocol error'
+ elif self.type == self.INVALID_TRANSFORM:
+ return 'Invalid transform'
+ elif self.type == self.INVALID_PROTOCOL:
+ return 'Invalid protocol'
+ elif self.type == self.UNSUPPORTED_CLIENT_TYPE:
+ return 'Unsupported client type'
else:
return 'Default (unknown) TApplicationException'
diff --git a/lib/rb/lib/thrift/exceptions.rb b/lib/rb/lib/thrift/exceptions.rb
index 2ccc7ce..68cb9e0 100644
--- a/lib/rb/lib/thrift/exceptions.rb
+++ b/lib/rb/lib/thrift/exceptions.rb
@@ -37,6 +37,9 @@
MISSING_RESULT = 5
INTERNAL_ERROR = 6
PROTOCOL_ERROR = 7
+ INVALID_TRANSFORM = 8
+ INVALID_PROTOCOL = 9
+ UNSUPPORTED_CLIENT_TYPE = 10
attr_reader :type