You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Serhii (Jira)" <ji...@apache.org> on 2019/12/23 12:24:00 UTC
[jira] [Updated] (THRIFT-5049) Process panic in generated processor
[ https://issues.apache.org/jira/browse/THRIFT-5049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Serhii updated THRIFT-5049:
---------------------------
Description:
Hello. In current version go generator doesn't provide functionality to handle panic in generated processor. For example you can do it like that:
{code:go}
func (p *someProcessor) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
// read args from protocol
result := SomeProcessorResult{}
var err2 error
if err2 = p.handler.SomeOperation(ctx, args.Op); err2 != nil {
-> there is switch case from err2
-> you can process panic in the same way like in "default" case for switch.
}
...
}
{code}
In current version on processor we need to process panic in custom server to send NewTApplicationException to clients and it is very uncomfortable.
Thanks.
was:
Hello. In current version go generator doesn't provide functionality to handle panic in generated processor. For example you can do it like that:
{code:golang}
func (p *someProcessor) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
// read args from protocol
result := SomeProcessorResult{}
var err2 error
if err2 = p.handler.SomeOperation(ctx, args.Op); err2 != nil {
-> there is switch case from err2
-> you can process panic in the same way like in "default" case for switch.
}
...
}
{code}
In current version on processor we need to process panic in custom server to send NewTApplicationException to clients and it is very uncomfortable.
Thanks.
> Process panic in generated processor
> ------------------------------------
>
> Key: THRIFT-5049
> URL: https://issues.apache.org/jira/browse/THRIFT-5049
> Project: Thrift
> Issue Type: Improvement
> Components: Go - Compiler
> Affects Versions: 0.13.0
> Reporter: Serhii
> Priority: Major
>
> Hello. In current version go generator doesn't provide functionality to handle panic in generated processor. For example you can do it like that:
> {code:go}
> func (p *someProcessor) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
> // read args from protocol
> result := SomeProcessorResult{}
> var err2 error
> if err2 = p.handler.SomeOperation(ctx, args.Op); err2 != nil {
> -> there is switch case from err2
> -> you can process panic in the same way like in "default" case for switch.
> }
> ...
> }
> {code}
>
> In current version on processor we need to process panic in custom server to send NewTApplicationException to clients and it is very uncomfortable.
> Thanks.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)