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 2017/06/01 20:22:04 UTC
[jira] [Comment Edited] (THRIFT-4215) Golang TTransportFactory
Pattern Squelches Errors
[ https://issues.apache.org/jira/browse/THRIFT-4215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16033618#comment-16033618 ]
Jens Geyer edited comment on THRIFT-4215 at 6/1/17 8:21 PM:
------------------------------------------------------------
{quote}
{code}
GetTransport(trans TTransport) (TTransport, error)
{code}
{quote}
Makes sense & looks much more idiomatic to me. I'm fine with it.
was (Author: jensg):
{quote}
{code}
GetTransport(trans TTransport) (TTransport, error
{code}
{quote}
Makes sense & looks much more idiomatic to me. I'm fine with it.
> Golang TTransportFactory Pattern Squelches Errors
> -------------------------------------------------
>
> Key: THRIFT-4215
> URL: https://issues.apache.org/jira/browse/THRIFT-4215
> Project: Thrift
> Issue Type: Bug
> Components: Go - Library
> Affects Versions: 0.10.0
> Reporter: James Mouradian
>
> The current (as of 72ca60d) pattern for [TTransport factories|https://github.com/apache/thrift/blob/master/lib/go/thrift/transport_factory.go#L26] in Golang is
> {code}
> type TTransportFactory interface {
> GetTransport(trans TTransport) TTransport
> }
> {code}
> This causes issues, because some {{TTransportFactory}} implementations can return and error. Consider the [THttpClientTransportFactory|https://github.com/apache/thrift/blob/master/lib/go/thrift/http_client.go#L52], which as of of 72ca60d, includes the following snippet:
>
> {code}
> s, _ := NewTHttpClientWithOptions(p.url, p.options)
> return s
> {code}
> 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.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)