mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
[DS-4014] added a catch in the DSpaceApiExceptionControllerAdvice for a generic exception and throws a 500 with cors headers available
This commit is contained in:

committed by
Tom Desair

parent
d7ec9e537a
commit
7c122e55aa
@@ -102,6 +102,13 @@ public class DSpaceApiExceptionControllerAdvice extends ResponseEntityExceptionH
|
||||
return super.handleTypeMismatch(ex, headers, HttpStatus.UNPROCESSABLE_ENTITY, request);
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
protected void handleGenericException(HttpServletRequest request, HttpServletResponse response, Exception ex)
|
||||
throws IOException {
|
||||
sendErrorResponse(request, response, ex, "An Exception has occured",
|
||||
HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
private void sendErrorResponse(final HttpServletRequest request, final HttpServletResponse response,
|
||||
final Exception ex, final String message, final int statusCode) throws IOException {
|
||||
//Make sure Spring picks up this exception
|
||||
|
Reference in New Issue
Block a user