handleNotFoundException method
- @ExceptionHandler(NotFoundException)
- ServerHttpRequest request,
- ServerHttpResponse response,
- WebRequest webRequest,
- NotFoundException exception,
Handles NotFoundException by returning an HTTP 404 (Not Found) response.
Response structure:
{
"status": 404,
"message": "Resource not found"
}
request: the HTTP request that caused the exceptionresponse: the HTTP response to populatewebRequest: the current web request contextexception: the thrown NotFoundException
Returns a ResponseBody with a 404 status code and no content.
Implementation
@ExceptionHandler(NotFoundException)
Future<ResponseBody<Object>> handleNotFoundException(
ServerHttpRequest request,
ServerHttpResponse response,
WebRequest webRequest,
NotFoundException exception
) async => ResponseBody.notFound();