@ControllerAdvice(basePackages="com.edorasware",
                  annotations=ApiController.class)
public class DefaultExceptionControllerAdvice
extends Object
implements org.springframework.context.EnvironmentAware
The public API controller advice which catches the exceptions and returns the proper error messages to the front end.
| Constructor and Description | 
|---|
DefaultExceptionControllerAdvice(org.springframework.context.MessageSource messageSource)  | 
| Modifier and Type | Method and Description | 
|---|---|
ErrorResponse | 
handleIllegal(IllegalArgumentException e,
             Locale locale)  | 
ErrorResponse | 
handleNotFound(EntityNotFoundException e,
              Locale locale)  | 
ErrorResponse | 
handleOneException(OneException e,
                  Locale locale)  | 
ErrorResponse | 
handleOtherException(Exception e,
                    Locale locale)  | 
ErrorResponse | 
handleUnauthorized(org.springframework.security.access.AccessDeniedException e,
                  Locale locale)  | 
void | 
setEnvironment(org.springframework.core.env.Environment environment)  | 
public DefaultExceptionControllerAdvice(org.springframework.context.MessageSource messageSource)
@ResponseStatus(value=BAD_REQUEST) @ExceptionHandler(value=java.lang.IllegalArgumentException.class) @ResponseBody public ErrorResponse handleIllegal(IllegalArgumentException e, Locale locale)
@ResponseStatus(value=UNAUTHORIZED) @ExceptionHandler(value=org.springframework.security.access.AccessDeniedException.class) @ResponseBody public ErrorResponse handleUnauthorized(org.springframework.security.access.AccessDeniedException e, Locale locale)
@ResponseStatus(value=NOT_FOUND) @ExceptionHandler(value=EntityNotFoundException.class) @ResponseBody public ErrorResponse handleNotFound(EntityNotFoundException e, Locale locale)
@ResponseStatus(value=INTERNAL_SERVER_ERROR) @ExceptionHandler(value=OneException.class) @ResponseBody public ErrorResponse handleOneException(OneException e, Locale locale)
@ResponseStatus(value=INTERNAL_SERVER_ERROR) @ExceptionHandler(value=java.lang.Exception.class) @ResponseBody public ErrorResponse handleOtherException(Exception e, Locale locale)
public void setEnvironment(org.springframework.core.env.Environment environment)
setEnvironment in interface org.springframework.context.EnvironmentAwareCopyright © 2010 - 2019 edorasware ag. All Rights Reserved.