Skip to content

Commit

Permalink
Avoid nesting of try-catch related to different aspects, one is colle…
Browse files Browse the repository at this point in the history
…ct the full stack trafe and debug log it, the other is send to DLQ
  • Loading branch information
andsel committed Sep 5, 2024
1 parent 86ebc05 commit b421e31
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,18 @@ public void notify(ConditionalEvaluationError err) {
try (StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw)) {
err.printStackTrace(pw);
LOGGER.debug("{}", sw);
if (javaDlqWriter != null) {
// if DLQ is enabled for pipeline
try {
javaDlqWriter.writeEntry(err.failedEvent(), "if-statement", "if-statement", "condition evaluation error, " + lastErrorEvaluationReceived);
} catch (IOException ioex) {
LOGGER.error("Can't write in DLQ", ioex);
}
}
} catch (IOException ioex) {
LOGGER.warn("Invalid operation on closing internal resources", ioex);
}

// if pipeline has DLQ enabled, send also there the event
if (javaDlqWriter != null) {
try {
javaDlqWriter.writeEntry(err.failedEvent(), "if-statement", "if-statement", "condition evaluation error, " + lastErrorEvaluationReceived);
} catch (IOException ioex) {
LOGGER.error("Can't write in DLQ", ioex);
}
}
}
}

Expand Down

0 comments on commit b421e31

Please sign in to comment.