You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Chris Bannister (JIRA)" <ji...@apache.org> on 2014/03/20 20:59:46 UTC

[jira] [Commented] (THRIFT-2418) Go handler function panics on internal error

    [ https://issues.apache.org/jira/browse/THRIFT-2418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13942205#comment-13942205 ] 

Chris Bannister commented on THRIFT-2418:
-----------------------------------------

Good spot, looks good to me.

> Go handler function panics on internal error
> --------------------------------------------
>
>                 Key: THRIFT-2418
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2418
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Compiler
>    Affects Versions: 0.9.2
>         Environment: All
>            Reporter: Frank Schroeder
>             Fix For: 0.9.2
>
>         Attachments: THRIFT-2418.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> The Go compiler is using the wrong err variable when handling an internal error in a handler method. Tested on fd62df75fa17d5c2af12302de6cee78ad7405692.
> The relevant generated code looks like this:
> {code}
> var err2 error
> if result.Success, err2 = p.handler.RemoveBatchBySource(args.SourceId, args.SourceSystem, args.SourceType, args.UserId); err2 != nil {
> 	x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing removeBatchBySource: "+err.Error())
> 	oprot.WriteMessageBegin("removeBatchBySource", thrift.EXCEPTION, seqId)
> 	x.Write(oprot)
> 	oprot.WriteMessageEnd()
> 	oprot.Flush()
> 	return false, err2
> }
> {code}
> The error in the {{TApplicationException}} should be {{err2.Error()}} and not {{err.Error()}}. Since {{err}} is {{nil}} at that point the server panics.
> The patch for the Go compiler is a simple one line fix is attached.



--
This message was sent by Atlassian JIRA
(v6.2#6252)