jameshilliard commented on a change in pull request #5034:
URL: https://github.com/apache/camel/pull/5034#discussion_r571469651



##########
File path: 
components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsProducer.java
##########
@@ -42,21 +47,42 @@ public NatsEndpoint getEndpoint() {
     }
 
     @Override
-    public void process(Exchange exchange) throws Exception {
+    public void process(Exchange exchange) {
         NatsConfiguration config = getEndpoint().getConfiguration();
         byte[] body = exchange.getIn().getBody(byte[].class);
         if (body == null) {
-            // fallback to use string
-            body = exchange.getIn().getMandatoryBody(String.class).getBytes();
+            try {
+                // fallback to use string
+                body = 
exchange.getIn().getMandatoryBody(String.class).getBytes();
+            } catch (InvalidPayloadException e) {
+                exchange.setException(e);

Review comment:
       reverted




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to