gnodet-bot commented on code in PR #27694:
URL: https://github.com/apache/camel/pull/27694#discussion_r4245841096


##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/service/WhatsAppServiceRestAPIAdapter.java:
##########
@@ -208,14 +222,12 @@ public void sendMessage(Exchange exchange, AsyncCallback 
callback, T message, St
                         exchange.getMessage().setBody(result);
                     } else {
                         LOG.debug("Error response Headers {}", 
response.headers());
-                        RuntimeException exception = new RuntimeCamelException(
-                                uri + " responded: " + statusCode + " and 
body: " + response.body());
-                        exchange.setException(exception);
-                        throw exception;
+                        exchange.setException(new RuntimeCamelException(
+                                uri + " responded: " + statusCode + " and 
body: " + response.body()));

Review Comment:
   💡 **Nit — inconsistent URI sanitization:** The connection-failure path above 
uses `URISupport.sanitizeUri(uri)` to avoid leaking credentials from the URI in 
error messages. This error-response path uses the raw `uri`. If the endpoint 
URI can contain credentials (e.g. a token in the query string), they would be 
exposed here. Consider applying `URISupport.sanitizeUri(uri)` consistently:
   
   ```suggestion
                           exchange.setException(new RuntimeCamelException(
                                   URISupport.sanitizeUri(uri) + " responded: " 
+ statusCode + " and body: " + response.body()));
   ```



-- 
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