Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void validateExpenseRequest(ExpenseRequest expenseRequest) {
private void validateUserSplitsBelongToGroup(Group group, Map<Long, BigDecimal> userSplits) {
for (Long userId : userSplits.keySet()) {
if (!groupMembershipRepository.existsByGroupAndUser_Id(group, userId)) {
throw new InvalidExpenseException("User with ID " + userId + " is not a member of the group.");
throw new ActionIsNotAllowedException("User with ID " + userId + " is not a member of the group.");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider reverting to InvalidExpenseException or using a more specific exception that aligns with data validation errors. ActionIsNotAllowedException typically indicates an authorization failure (HTTP 403), while this scenario is a data validation issue (user not in group). A 400 Bad Request might be more appropriate.

Suggested change
throw new ActionIsNotAllowedException("User with ID " + userId + " is not a member of the group.");
throw new InvalidExpenseException("User with ID " + userId + " is not a member of the group.");

}
}
}
Expand Down
Loading