Skip to content

Commit

Permalink
DST-16017 : Change error message when getting NoSuchAttributeException (
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmccormackbconline authored Aug 20, 2024
1 parent afcd8ab commit e5d33fa
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.http.HttpStatus;
import org.springframework.ldap.NoSuchAttributeException;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.stereotype.Component;
import org.springframework.validation.ObjectError;
Expand Down Expand Up @@ -107,6 +108,14 @@ public ErrorResponse handle(BulkheadFullException exception) {
return new ErrorResponse("An export task is currently in progress. Please try again later.");
}

@ExceptionHandler
@ResponseBody
@ResponseStatus(HttpStatus.CONFLICT)
public ErrorResponse handle(NoSuchAttributeException exception) {
log.error("Returning 409 response", exception);
return new ErrorResponse("User account is corrupted, please contact the help desk");
}

private <T> T getLast(Iterator<T> propertyPath) {
T node = null;
while (propertyPath.hasNext()) node = propertyPath.next();
Expand Down

0 comments on commit e5d33fa

Please sign in to comment.