You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (Jira)" <ji...@apache.org> on 2021/09/11 12:32:02 UTC

[jira] [Closed] (THRIFT-5459) Adding a new exception to an endpoint is kinda breaking in go

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

Jens Geyer closed THRIFT-5459.
------------------------------

> 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)