[
https://issues.apache.org/jira/browse/THRIFT-3867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15424295#comment-15424295
]
ASF GitHub Bot commented on THRIFT-3867:
----------------------------------------
Github user erikvanoosten commented on the issue:
https://github.com/apache/thrift/pull/1036
@Jens-G wrote:
> The Thrift compiler prevents the combination of oneway plus throws right
from the start since March 2003, any types other than void are disallowed since
THRIFT-2030. So that does not hold.
I looked at it again. `ProcessFunction` in thrift 0.9.3 contains the
following:
```
try {
result = getResult(iface, args);
} catch(TException tex) {
LOGGER.error("Internal error processing " + getMethodName(), tex);
TApplicationException x = new
TApplicationException(TApplicationException.INTERNAL_ERROR,
"Internal error processing " + getMethodName());
oprot.writeMessageBegin(new TMessage(getMethodName(),
TMessageType.EXCEPTION, seqid));
x.write(oprot);
oprot.writeMessageEnd();
oprot.getTransport().flush();
return;
}
```
As you can see when `getResult` throws it is encoded regardless of oneway.
You may ask when does `getResult` throw? Looking at the generated code, for
example:
```
public getById_result getResult(I iface, getById_args args) throws
org.apache.thrift.TException {
getById_result result = new getById_result();
try {
result.success = iface.getById(args.userId);
} catch (UserNotFoundException exc1) {
result.exc1 = exc1;
}
return result;
}
```
it throws when it can not decode the request, or when the service
implementation throws any unchecked exception.
> Specify BinaryProtocol and CompactProtocol
> ------------------------------------------
>
> Key: THRIFT-3867
> URL: https://issues.apache.org/jira/browse/THRIFT-3867
> Project: Thrift
> Issue Type: Documentation
> Components: Documentation
> Reporter: Erik van Oosten
>
> It would be nice when the protocol(s) would be specified somewhere. This
> should improve communication between developers, but also opens the way for
> alternative implementations so that Thrift can thrive even better.
> I have a fairly complete description of the BinaryProtocol and
> CompactProtocol which I will submit as a patch for further review and
> discussion.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)