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

Golang TTransportFactory Pattern Squelches Errors

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.10.0
    • 0.11.0
    • Go - Library
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: