THRIFT-5823 Fix illegal uses of exceptions as normal struct type
Patch: Jens Geyer
This closes #1928
diff --git a/lib/go/test/ClientMiddlewareExceptionTest.thrift b/lib/go/test/ClientMiddlewareExceptionTest.thrift
index 647c433..b48a611 100644
--- a/lib/go/test/ClientMiddlewareExceptionTest.thrift
+++ b/lib/go/test/ClientMiddlewareExceptionTest.thrift
@@ -25,11 +25,11 @@
// This is a special case, we want to make sure that the middleware don't
// accidentally pull result as error.
-exception FooResponse {
+struct/*exception*/ FooResponse { // returning an exception by any means other than "throws" is illegal
}
service ClientMiddlewareExceptionTest {
- FooResponse foo() throws(
+ FooResponse foo() throws( // returning an exception by any means other than "throws" is illegal
1: Exception1 error1,
2: Exception2 error2,
)
diff --git a/lib/go/test/ForwardType.thrift b/lib/go/test/ForwardType.thrift
index 0433c97..9e3670e 100644
--- a/lib/go/test/ForwardType.thrift
+++ b/lib/go/test/ForwardType.thrift
@@ -25,6 +25,7 @@
1: optional Exc foo
}
-exception Exc {
+// FIX: Use of "exception" is illegal. An exception is not a normal struct type and cannot be used as such.
+struct Exc {
1: optional i32 code
}