Package dev.voidframework.web.http
Interface ErrorHandler
- All Known Implementing Classes:
DefaultErrorHandler
public interface ErrorHandler
This interface allows you to define the behaviour to have when an error occurs.
-
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.
-
Method Details
-
onBadRequest
This method is called when the provided request is invalid.- Parameters:
context- The current contextbadRequestException- The cause (OPTIONAL)- Returns:
- A result
-
onNotFound
This method is called when no route has been found to satisfy the request.- Parameters:
context- The current contextnotFoundException- The cause (OPTIONAL)- Returns:
- A result
-
onServerError
This method is called when an unexpected error occurs during the processing of the request.- Parameters:
context- The current contextthrowable- The cause- Returns:
- A result
-