Package dev.voidframework.web.http.impl
Class DefaultErrorHandler
java.lang.Object
dev.voidframework.web.http.impl.DefaultErrorHandler
- All Implemented Interfaces:
ErrorHandler
Default implementation of
ErrorHandler.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents a single content line. -
Constructor Summary
ConstructorsConstructorDescriptionDefaultErrorHandler(com.typesafe.config.Config configuration, Router router) Build a new instance. -
Method Summary
Modifier and TypeMethodDescriptiononBadRequest(Context context, HttpException.BadRequest badRequestException) This method is called when the provided request is invalid.onNotFound(Context context, HttpException.NotFound notFoundException) This method is called when no route has been found to satisfy the request.onServerError(Context context, Throwable throwable) This method is called when an unexpected error occurs during the processing of the request.
-
Constructor Details
-
DefaultErrorHandler
Build a new instance.- Parameters:
configuration- The application configurationrouter- The router
-
-
Method Details
-
onBadRequest
Description copied from interface:ErrorHandlerThis method is called when the provided request is invalid.- Specified by:
onBadRequestin interfaceErrorHandler- Parameters:
context- The current contextbadRequestException- The cause (OPTIONAL)- Returns:
- A result
-
onNotFound
Description copied from interface:ErrorHandlerThis method is called when no route has been found to satisfy the request.- Specified by:
onNotFoundin interfaceErrorHandler- Parameters:
context- The current contextnotFoundException- The cause (OPTIONAL)- Returns:
- A result
-
onServerError
Description copied from interface:ErrorHandlerThis method is called when an unexpected error occurs during the processing of the request.- Specified by:
onServerErrorin interfaceErrorHandler- Parameters:
context- The current contextthrowable- The cause- Returns:
- A result
-