public class AnnotatedWebErrorHandler extends Object implements WebErrorHandler
WebErrorHandler implementation responsible for handling exceptions annotated with
the ExceptionMapping annotation. The web error code and status code would be
extracted form the annotated exception. Also, any member annotated with ExposeAsArg
would be exposed as arguments.ExposeAsArg,
ExceptionMapping| Constructor and Description |
|---|
AnnotatedWebErrorHandler() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canHandle(Throwable exception)
Only can handle non-null exceptions annotated with
ExceptionMapping annotation. |
HandledException |
handle(Throwable exception)
Handles the thrown exception annotated with
ExceptionMapping by using the
ExceptionMapping.errorCode() as the error code, the ExceptionMapping.statusCode()
as the HTTP status code and also, exposing exception members annotated with ExposeAsArg. |
public boolean canHandle(Throwable exception)
ExceptionMapping annotation.canHandle in interface WebErrorHandlerexception - The exception to examine.true if the exception is annotated with ExceptionMapping, false
otherwise.@NonNull public HandledException handle(Throwable exception)
ExceptionMapping by using the
ExceptionMapping.errorCode() as the error code, the ExceptionMapping.statusCode()
as the HTTP status code and also, exposing exception members annotated with ExposeAsArg.handle in interface WebErrorHandlerexception - The exception to handle.HandledException instance encapsulating the error code, status code and
all to-be-exposed arguments.Copyright © 2018. All rights reserved.