krisztina-zsihovszki commented on code in PR #7007:
URL: https://github.com/apache/nifi/pull/7007#discussion_r1132444658
##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutSQL.java:
##########
@@ -836,7 +870,17 @@ boolean isFragmentedTransactionReady(final List<FlowFile>
flowFiles, final Long
return false; // not enough FlowFiles for this transaction. Return
them all to queue.
}
+ private FlowFile addErrorAttributesToFlowFile(final ProcessSession
session, FlowFile flowFile, final Exception exception) {
+ final Map<String, String> attributes = new HashMap<>();
+ attributes.put(ERROR_MESSAGE_ATTR, exception.getMessage());
+ if (exception instanceof SQLException) {
+ attributes.put(ERROR_CODE_ATTR, valueOf(((SQLException)
exception).getErrorCode()));
+ attributes.put(ERROR_SQL_STATE_ATTR, valueOf(((SQLException)
exception).getSQLState()));
+ }
+
+ return session.putAllAttributes(flowFile, attributes);
Review Comment:
The method adds extra attributes to the FlowFile, it does not remove any
existing attribute. (Added a check in unit tests to verify this.)
--
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]