Andrea Cosentino created CAMEL-25460:
----------------------------------------

             Summary: camel-thrift - add a muteException consumer option
                 Key: CAMEL-25460
                 URL: https://issues.apache.org/jira/browse/CAMEL-25460
             Project: Camel
          Issue Type: Improvement
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino
             Fix For: 4.24.0, 4.18.6, 4.22.3


CAMEL-23651, and then CAMEL-24428, CAMEL-24476, CAMEL-24477, CAMEL-24478 and 
CAMEL-25087, gave the consumers that reply to the caller a {{muteException}} 
option defaulting to {{true}}, so that a failed exchange does not return the 
exception's message to the remote caller. camel-thrift has no such option.

In the default asynchronous mode, {{ThriftMethodHandler}} passes the exception 
of a failed exchange to the Thrift callback:

{code:java}
Exception exception = exchange.getException();
if (exception != null) {
    callback.onError(exception);
    return;
}
{code}

The processor that the Thrift compiler generates sends any exception the method 
does not declare as {{new 
TApplicationException(TApplicationException.INTERNAL_ERROR, e.getMessage())}}. 
Since CAMEL-25247 the synchronous handler throws the exception instead. 
libthrift then answers most exceptions with a generic "Internal error 
processing <method>", but sends a {{TApplicationException}} with its own 
message. That includes one returned to the route by a downstream Thrift call. 
CAMEL-25247 is only on main, so on camel-4.22.x and camel-4.18.x only the 
asynchronous handler is concerned.

Proposal: add a {{muteException}} consumer option, defaulting to {{true}}. When 
enabled, both servers answer any exception that the Thrift method does not 
declare with a generic {{TApplicationException(INTERNAL_ERROR)}}. Exceptions 
declared in the IDL, such as {{throws (1:InvalidOperation ouch)}}, belong to 
the service contract and are still sent as they are. Add an upgrade-guide entry 
saying that routes relying on the detail must set {{muteException=false}}.

_Claude Code on behalf of oscerd_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to