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
 }
diff --git a/lib/netstd/Tests/Thrift.Compile.Tests/Thrift5320.exception.thrift b/lib/netstd/Tests/Thrift.Compile.Tests/Thrift5320.exception.thrift
index 37421c0..d61a300 100644
--- a/lib/netstd/Tests/Thrift.Compile.Tests/Thrift5320.exception.thrift
+++ b/lib/netstd/Tests/Thrift.Compile.Tests/Thrift5320.exception.thrift
@@ -24,7 +24,10 @@
 
 
 exception Task { 
-	1: Task left 
-	2: Task right 
+	1: ErrorData data  // it would be illegal to use exception as struct type
+}
+
+struct ErrorData {
+	1: string messitsch
 }