Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.16.0
-
None
Description
This is an example snippet generated by the current version of compiler:
result := ResultType{} var retval *ResponseType if retval, err2 = p.handler.Handler(ctx, args.Request); err2 != nil { tickerCancel() switch v := err2.(type) { case *ThriftIDLDefinedExceptionType: result.Err = v default: if err2 == thrift.ErrAbandonRequest { return false, thrift.WrapTException(err2) } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing authenticateCookie: "+err2.Error()) oprot.WriteMessageBegin(ctx, "handler", thrift.EXCEPTION, seqId) x.Write(ctx, oprot) oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) return true, thrift.WrapTException(err2) } } else { result.Success = retval } tickerCancel() if err3 := oprot.WriteMessageBegin(ctx, "handler", thrift.REPLY, seqId); err3 != nil { err = thrift.WrapTException(err3) } if err4 := result.Write(ctx, oprot); err == nil && err4 != nil { err = thrift.WrapTException(err4) } if err5 := oprot.WriteMessageEnd(ctx); err == nil && err5 != nil { err = thrift.WrapTException(err5) } if err6 := oprot.Flush(ctx); err == nil && err6 != nil { err = thrift.WrapTException(err6) } if err != nil { return } return true, err
so, when a handler returns ThriftIDLDefinedExceptionType exception, the Process function would only return an error if it fails to write the exception to the wire, and nil-error if the writing was successful. This will cause the processer middlewares unable to access any exceptions defined in thrift IDLs.
Attachments
Issue Links
- links to