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.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to