mattyb149 commented on a change in pull request #4052: NIFI-7139 Add 
record.error.message on failure of a record reader or w…
URL: https://github.com/apache/nifi/pull/4052#discussion_r379023469
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractRecordProcessor.java
 ##########
 @@ -174,6 +174,7 @@ public void process(final InputStream in, final 
OutputStream out) throws IOExcep
             });
         } catch (final Exception e) {
             getLogger().error("Failed to process {}; will route to failure", 
new Object[] {flowFile, e});
+            
session.putAttribute(flowFile,"record.error.message",e.getCause().getLocalizedMessage());
 
 Review comment:
   Is it possible that `getCause()` will return null here? In that case we 
could probably return `e.getLocalizedMessage()`, and if either message is null, 
we should probably return the class name of the exception/cause.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to