You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@thrift.apache.org by GitBox <gi...@apache.org> on 2022/08/01 22:16:32 UTC

[GitHub] [thrift] fishy commented on a diff in pull request #2637: THRIFT-5605: Client middleware to extract exceptions

fishy commented on code in PR #2637:
URL: https://github.com/apache/thrift/pull/2637#discussion_r934960128


##########
lib/go/thrift/middleware.go:
##########
@@ -107,3 +110,76 @@ func WrapClient(client TClient, middlewares ...ClientMiddleware) TClient {
 	}
 	return client
 }
+
+// For a endpoint defined in thrift IDL like this:
+//
+//     service MyService {
+//       FooResponse foo(1: FooRequest request) throws (
+//         1: Exception1 error1,
+//         2: Exception2 error2,
+//       )
+//     }
+//
+// The thrift compiler generated go code for the result TStruct would be like:
+//
+//     type MyServiceFooResult struct {
+//       Success *FooResponse `thrift:"success,0" db:"success" json:"success,omitempty"`
+//       Error1 *Exception1 `thrift:"error1,1" db:"error1" json:"error1,omitempty"`
+//       Error2 *Exception2 `thrift:"error2,2" db:"error2" json:"error2,omitempty"`
+//     }
+func getClientError(result TStruct, err error) error {

Review Comment:
   @dcelasun I'm also debating whether to export this as a public API, and if yes, what's a good name for it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org