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

Golang TTransportFactory Pattern Squelches Errors

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.11.0
    • Component/s: Go - Library
    • Labels:
      None

      Description

      The current (as of 72ca60d) pattern for TTransport factories in Golang is

      type TTransportFactory interface {
      	GetTransport(trans TTransport) TTransport
      }
      

      This causes issues, because some TTransportFactory implementations can return and error. Consider the THttpClientTransportFactory, which as of of 72ca60d, includes the following snippet:

      	s, _ := NewTHttpClientWithOptions(p.url, p.options)
      	return s
      

      The call to NewTHttpClientWithOptions(...) call can throw errors. The resultant behavior is that nil is returned in place of a valid TTransport, with a nil error.

      The TTransportFactory interface (and associated use patterns) should be extended to include errors.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dcelasun Duru Can Celasun
                Reporter:
                jmrdi James Mouradian
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: