Skip to content

Commit e8e6765

Browse files
fix(digest): return 400 when EMAIL delivery is requested
IllegalArgumentException from the prefs controller used to become a 500 with no message. Map it to a 400 so the UI can show that email delivery is not available yet. Co-authored-by: Venkat SF <venkatesh.sakamuri@stayflexi.com>
1 parent adeec4f commit e8e6765

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎backend/src/main/java/com/dbaagent/controller/DigestPreferenceController.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,4 +281,9 @@ public record PreferencePreview(String username, String connectionId, String per
281281
public record SeedResultResponse(int usersProcessed, int preferencesCreated, List<String> skipped) {}
282282

283283
public record DigestStatusResponse(boolean perUserMode, long enabledPreferences, int distinctUsers) {}
284+
285+
@ExceptionHandler(IllegalArgumentException.class)
286+
public ResponseEntity<Map<String, String>> handleBadRequest(IllegalArgumentException e) {
287+
return ResponseEntity.badRequest().body(Map.of("message", e.getMessage() != null ? e.getMessage() : "Bad request"));
288+
}
284289
}

0 commit comments

Comments
 (0)