oscerd opened a new pull request, #26994:
URL: https://github.com/apache/camel/pull/26994

   [CAMEL-25087](https://issues.apache.org/jira/browse/CAMEL-25087)
   
   ## Description
   
   Adds a `muteException` consumer option to camel-coap, defaulting to `true`: 
the default the HTTP consumers carry, and the one `camel-knative`, 
`camel-mina`, `camel-cxf` and `camel-grpc` adopted in CAMEL-24428, CAMEL-24476, 
CAMEL-24477 and CAMEL-24478.
   
   `CamelCoapResource.handleRequest` changes in two places:
   
   - **A failed exchange is answered with `5.00 Internal Server Error`.** The 
resource did not check `isFailed()` after the route ran, so a route failure was 
answered with `2.05 Content` and whatever body the message held when the route 
failed.
   - **The error response's payload follows `muteException`.** When muted (the 
default) the payload is empty; with `muteException=false` it is the exception's 
message. That applies both to a route failure and to a failure while building 
the response, such as converting the final body to `byte[]`, which previously 
always returned its message.
   
   A failure while building the response is now also reported through the 
consumer's `ExceptionHandler`. It was not logged anywhere before, and a muted 
client no longer receives it.
   
   The option is on the endpoint, so it covers all four schemes (`coap`, 
`coaps`, `coap+tcp`, `coaps+tcp`) and Rest DSL consumers, which can set it with 
`restConfiguration().endpointProperty("muteException", "false")`.
   
   ## Tests
   
   - `CoAPMuteExceptionTest`: a route failure and a response-building failure, 
each muted by default and with `muteException=false`, plus an unchanged 
successful exchange.
   - `CoAPRestMuteExceptionTest`: a failing Rest DSL route is muted by default.
   - With the `CamelCoapResource` change reverted, four of the six new tests 
fail.
   - The `camel-coap` tests pass (73), and the full reactor builds with 
`-DskipTests -DskipITs`; the only regenerated changes are for the new option.
   
   ## Documentation
   
   - New "Error responses from the CoAP consumer" section in 
`coap-component.adoc`; the option also appears in the generated options table.
   - Upgrade-guide notes in the 4.23 guide, and in main's 4.22 (4.22.1 to 
4.22.2) and 4.18 (4.18.4 to 4.18.5) guides for the planned backports to 
`camel-4.22.x` and `camel-4.18.x`, since the upgrade guides of every release 
line live on `main`.
   
   _Claude Code on behalf of oscerd_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to