Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5459

Adding a new exception to an endpoint is kinda breaking in go

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.14.2
    • 0.15.0
    • Go - Compiler
    • None

    Description

      Say we have a foo endpoint with definition:

       

      service Foo {
        FooResponse foo(1: FooRequest request) throws(1: Error1 error1);
      }

      And we add a new exception to it later:

      service Foo {
       FooResponse foo(1: FooRequest request) throws(1: Error1 error1, 2: Error2 error2);
      }
      

      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:

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

      We need to do the same in go.

       

      Attachments

        Issue Links

          Activity

            People

              fishywang Yuxuan Wang
              fishywang Yuxuan Wang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h