[ https://issues.apache.org/jira/browse/THRIFT-5792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17864815#comment-17864815 ]
Yuxuan Wang commented on THRIFT-5792: ------------------------------------- go's reflection is not that inefficient (unlike java), the implementation of ExtractExceptionFromResult is just O(N) with N being the number of exceptions defined on the endpoint, which is usually a very small number. The method you proposed will likely not be really trivial to implement, and it involves a lot of compiler changes to change the generated go code. If you already have an implementation, please open the PR for review. > Generate a method for retrieving IDL exceptions in Go without using reflection > ------------------------------------------------------------------------------ > > Key: THRIFT-5792 > URL: https://issues.apache.org/jira/browse/THRIFT-5792 > Project: Thrift > Issue Type: Improvement > Components: Go - Compiler > Reporter: Long Bui > Priority: Trivial > > Currently, the only way to retrieve IDL exceptions in Go is by using > [ExtractExceptionFromResult|https://github.com/apache/thrift/blob/1405831722ac0e1e1ba100801bf21073a0d17940/lib/go/thrift/exception.go#L141], > and as you can see, this method uses reflection to traverse through all > fields. This is not an effective approach when the Result structure is large. > Therefore, I propose adding an *Exception() error* method to the generated > *Result* structure for retrieving IDL exceptions in an efficient way. -- This message was sent by Atlassian Jira (v8.20.10#820010)