[ https://issues.apache.org/jira/browse/THRIFT-5823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17898717#comment-17898717 ]
Yuxuan Wang commented on THRIFT-5823: ------------------------------------- [~jensg] can we reconsider this issue/discuss it more? Using exception type as a field to a struct/exception is actually used in the wild occasionally, and this change will break them (those thrift files won't compile anymore with 0.22.0). The most common case this is currently used is to return partial errors/success. Thrift does not allow return both a response and an exception, so when an endpoint could return partial success, they choose to add the partial error info into the response struct, something like: {code:thrift} struct FooResponse { 1: optional Bar some_data; 2: optional FooException partial_error; } service Foo { FooResponse foo(...) throws (1: FooException error); } {code} Of course they can define another struct to be used for the partial_error field, but that require additional work of migration to the new field on the wire protocol. What's the consequence of allowing exception types to be used as struct fields? Is it that in some languages thrift supports, it's not allowed to have a nested exception type? From my understanding most languages allow that (java, go, python, to name a few). > Fix illegal uses of exceptions as normal struct type > ---------------------------------------------------- > > Key: THRIFT-5823 > URL: https://issues.apache.org/jira/browse/THRIFT-5823 > Project: Thrift > Issue Type: Bug > Components: Compiler (General) > Reporter: Jens Geyer > Assignee: Jens Geyer > Priority: Major > Fix For: 0.22.0 > > Attachments: THRIFT-5823.thrift > > Time Spent: 1h > Remaining Estimate: 0h > > Fix illegal uses of exvceptions as normal struct type, which it really isn't. > Applies to a number of test IDL files and various tickets. -- This message was sent by Atlassian Jira (v8.20.10#820010)