[ 
https://issues.apache.org/jira/browse/THRIFT-5459?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yuxuan Wang resolved THRIFT-5459.
---------------------------------
    Resolution: Fixed

> Adding a new exception to an endpoint is kinda breaking in go
> -------------------------------------------------------------
>
>                 Key: THRIFT-5459
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5459
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Compiler
>    Affects Versions: 0.14.2
>            Reporter: Yuxuan Wang
>            Assignee: Yuxuan Wang
>            Priority: Major
>             Fix For: 0.15.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Say we have a foo endpoint with definition:
>  
> {code:java}
> service Foo {
>   FooResponse foo(1: FooRequest request) throws(1: Error1 error1);
> }{code}
> And we add a new exception to it later:
> {code:java}
> service Foo {
>  FooResponse foo(1: FooRequest request) throws(1: Error1 error1, 2: Error2 
> error2);
> }
> {code}
> And when a client hasn't updated to the updated version, and server returns 
> error2, the client will actually get both nil response and nil error.
> I checked python version's implementation, and the compiler generated code 
> will actually avoid this situation:
> {code:java}
> ...
> if result.success is not None:
>   return result.success
> if result.error1 is not None:
>   raise result.error1
> raise TApplicationException(TApplicationException.MISSING_RESULT, "foo 
> failed: unknown result"){code}
> We need to do the same in go.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to