@Override
    public HttpResponse handleException(ServiceRequestContext ctx, HttpRequest req, Throwable cause) {
        if (cause instanceof IllegalArgumentException) {
            final String message = cause.getMessage();
            final ObjectNode objectNode = mapper.createObjectNode();
            objectNode.put("error", message);
            return HttpResponse.ofJson(HttpStatus.BAD_REQUEST, objectNode);
        }
        return ExceptionHandlerFunction.fallthrough();
    }
Handles an {@link IllegalArgumentException} and returns an {@link HttpResponse} with
{@link HttpStatus#BAD_REQUEST}.
examples/tutorials/rest-api-annotated-service/src/main/java/example/armeria/server/blog/BadRequestExceptionHandler.java