Skip to content
Snippets Groups Projects
Commit a76cb1be authored by Tucker Gary Siegel's avatar Tucker Gary Siegel
Browse files

expand

parent ceceacf6
No related branches found
Tags 0.11.0
No related merge requests found
...@@ -51,6 +51,11 @@ public class CustomExceptionHandler { ...@@ -51,6 +51,11 @@ public class CustomExceptionHandler {
return returnDawnException(wrapped); return returnDawnException(wrapped);
} }
private ResponseEntity<Object> wrapExceptionAs(Exception exception, DawnExceptionParameters parameters) {
DawnException wrapped = new DawnException(parameters, exception);
return returnDawnException(wrapped);
}
@ExceptionHandler(BindException.class) @ExceptionHandler(BindException.class)
protected ResponseEntity<Object> handleBindException(BindException ex, WebRequest request) { protected ResponseEntity<Object> handleBindException(BindException ex, WebRequest request) {
...@@ -68,14 +73,24 @@ public class CustomExceptionHandler { ...@@ -68,14 +73,24 @@ public class CustomExceptionHandler {
ArrayIndexOutOfBoundsException exception, WebRequest webRequest) { ArrayIndexOutOfBoundsException exception, WebRequest webRequest) {
return wrapExceptionAs(exception, BaseExceptions.OUT_OF_BOUNDS); return wrapExceptionAs(exception, BaseExceptions.OUT_OF_BOUNDS);
} }
@ExceptionHandler(DawnException.class)
public ResponseEntity<Object> handleDawnExceptions(DawnException exception, WebRequest webRequest) {
return returnDawnException(exception);
}
@ExceptionHandler(RuntimeException.class) @ExceptionHandler(RuntimeException.class)
public ResponseEntity<Object> handleUnHandledException(RuntimeException exception, WebRequest webRequest) { public ResponseEntity<Object> handleUnHandledException(RuntimeException exception, WebRequest webRequest) {
return wrapExceptionAs(exception, BaseExceptions.UNHANDLED_INTERNAL_SERVER_ERROR); return wrapExceptionAs(exception, BaseExceptions.UNHANDLED_INTERNAL_SERVER_ERROR);
} }
@ExceptionHandler(DawnException.class) @ExceptionHandler(Exception.class)
public ResponseEntity<Object> handleDawnExceptions(DawnException exception, WebRequest webRequest) { public ResponseEntity<Object> handleUnHandledException(Exception exception, WebRequest webRequest) {
return returnDawnException(exception); return wrapExceptionAs(exception, BaseExceptions.UNHANDLED_INTERNAL_SERVER_ERROR);
}
@ExceptionHandler(Throwable.class)
public ResponseEntity<Object> handleUnHandledException(Throwable exception, WebRequest webRequest) {
return wrapExceptionAs((Exception)exception, BaseExceptions.UNHANDLED_INTERNAL_SERVER_ERROR);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment