Skip to content

Commit

Permalink
fix: Write status to emailk send request response (#4652)
Browse files Browse the repository at this point in the history
  • Loading branch information
connoratrug authored Jan 30, 2025
1 parent cb58246 commit 92415bc
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public static String send(Context ctx) {
ctx.status(422);
String msg = "Error parsing request: " + e.getMessage();
logger.error(msg);
ctx.result(msg);
return msg;
}

Expand All @@ -86,6 +87,7 @@ public static String send(Context ctx) {
String msg =
"Error validating message receivers: " + executionResult.getErrors().get(0).getMessage();
logger.error(msg);
ctx.result(msg);
return msg;
}
Map<String, Object> resultMap = executionResult.toSpecification();
Expand All @@ -97,13 +99,15 @@ public static String send(Context ctx) {
ctx.status(500);
String msg = "Error validating message receivers: " + e.getMessage();
logger.error(msg);
ctx.result(msg);
return msg;
}

if (recipients.isEmpty()) {
ctx.status(500);
String msg = "No recipients found for given filter";
logger.error(msg);
ctx.result(msg);
return msg;
}

Expand Down Expand Up @@ -133,6 +137,7 @@ public static String send(Context ctx) {
sendMessageAction.subject(),
sendMessageAction.body());
}
ctx.result(String.valueOf(sendResult));
return String.valueOf(sendResult);
}

Expand Down

0 comments on commit 92415bc

Please sign in to comment.