You scream, I scream, We all scream for exceptions
Added exception defintions and specifiers to thrift grammar
Modified C++ code generator to to catch and serialize exceptions on the server side and unmarshall and throw them on the client side.
Modified grammar to require "," after each service function declaration to keep it consistent with struct declaration syntax
This checkin officially breaks the old parser
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664754 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/ThriftTest.thrift b/test/ThriftTest.thrift
index a8f5d86..178f4df 100644
--- a/test/ThriftTest.thrift
+++ b/test/ThriftTest.thrift
@@ -31,27 +31,50 @@
list<Xtruct> xtructs = 1
}
+exception Exception {
+ u32 errorCode,
+ string message
+}
+
+exception Xception {
+ u32 errorCode,
+ Xtruct struct_thing
+}
+
struct Empty {}
+struct OneField {
+ Empty field
+}
service ThriftTest
{
- void testVoid()
- string testString(string thing = 0)
- byte testByte(byte thing = 0)
- i32 testI32(i32 thing = 0)
- i64 testI64(i64 thing = 0)
- Xtruct testStruct(Xtruct thing = 0)
- Xtruct2 testNest(Xtruct2 thing = 0)
- map<i32,i32> testMap(map<i32,i32> thing = 0)
- set<i32> testSet(set<i32> thing = 0)
- list<i32> testList(list<i32> thing = 0)
- Numberz testEnum(Numberz thing = 0)
- UserId testTypedef(UserId thing = 0)
+ void testVoid(),
+ string testString(string thing = 0),
+ byte testByte(byte thing = 0),
+ i32 testI32(i32 thing = 0),
+ i64 testI64(i64 thing = 0),
+ Xtruct testStruct(Xtruct thing = 0),
+ Xtruct2 testNest(Xtruct2 thing = 0),
+ map<i32,i32> testMap(map<i32,i32> thing = 0),
+ set<i32> testSet(set<i32> thing = 0),
+ list<i32> testList(list<i32> thing = 0),
+ Numberz testEnum(Numberz thing = 0),
+ UserId testTypedef(UserId thing = 0),
- map<i32,map<i32,i32>> testMapMap(i32 hello = 0)
+ map<i32,map<i32,i32>> testMapMap(i32 hello = 0),
/* So you think you've got this all worked, out eh? */
- map<UserId, map<Numberz,Insanity>> testInsanity(Insanity argument = 0)
+ map<UserId, map<Numberz,Insanity>> testInsanity(Insanity argument = 0),
+
+ /* Multiple parameters */
- Xtruct testMulti(byte arg0, i32 arg1, u64 arg2, map<i16, string> arg3, Numberz arg4, UserId arg5)
+ Xtruct testMulti(byte arg0, i32 arg1, u64 arg2, map<i16, string> arg3, Numberz arg4, UserId arg5),
+
+ /* Exception specifier */
+
+ Xtruct testException(string arg) throws(Exception err1),
+
+ /* Multiple exceptions specifier */
+
+ Xtruct testMultiException(string arg0, string arg1) throws(Exception err1=1, Xception err2)
}