Skip to content

Commit

Permalink
removed the runtime exception
Browse files Browse the repository at this point in the history
  • Loading branch information
ranim-n committed Sep 17, 2024
1 parent 8fc2631 commit cd31682
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void indexEvents(final List<Map<String, Object>> events, final ReportingC
preparedEvent.put("previous_attributes", objectMapper.writeValueAsString(event.get("previous_attributes")));

} catch (JsonProcessingException e) {
throw new RuntimeException(e);
getLogger().error("Error while writing value", e);
}
if (event.containsKey("details"))
preparedEvent.put("details", event.get("details"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public class EmailProvenanceReporter extends AbstractProvenanceReporter {
.description("Specifies whether to group multiple error events into a single email or not." +
" Set to true to receive an email with grouped errors. " +
"Set to false to receive individual emails for each error." +
" The grouping is by process and error information")
" The grouping is by processor and error information")
.required(false)
.defaultValue("false")
.addValidator(StandardValidators.BOOLEAN_VALIDATOR)
Expand Down Expand Up @@ -371,15 +371,15 @@ public void indexEvents(final List<Map<String, Object>> events, final ReportingC

if (context.getProperty(GROUP_SIMILAR_ERRORS).asBoolean()) {
// Group all error events to send in a single batch email
Map<Map<String, String>, List<Map<String, Object>>> batchGroupedEvents = events.stream()
.collect(Collectors.groupingBy(event -> groupingKeys(event)));
batchGroupedEvents.forEach((groupingKeys, groupedEvents) -> {
try {
sendErrorEmail(groupedEvents.get(0), context, groupedEvents.size());
} catch (MessagingException e) {
getLogger().error("Error sending error email: " + e.getMessage(), e);
}
});
events.stream()
.collect(Collectors.groupingBy(event -> groupingKeys(event)))
.forEach((groupingKeys, groupedEvents) -> {
try {
sendErrorEmail(groupedEvents.get(0), context, groupedEvents.size());
} catch (MessagingException e) {
getLogger().error("Error sending error email: " + e.getMessage(), e);
}
});
} else {
// Send individual emails for each error event
for (Map<String, Object> event : errorEvents) {
Expand Down

0 comments on commit cd31682

Please sign in to comment.