-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement
Milestone
Description
This is currently possible, but could be better:
RouterFunctions.route()
.GET("/path", request -> {
throw new IllegalArgumentException("...");
})
.onError(IllegalArgumentException.class, (ex, serverRequest) -> {
ErrorResponse errorResponse = ErrorResponse.createFor(
(Exception) ex, HttpStatus.BAD_REQUEST, null, "Invalid input", null, null);
return ServerResponse.status(errorResponse.getStatusCode())
.body(errorResponse.getBody());
})
.build()
We could add a ServerResponse#from(ErrorResponse)
shortcut, and also provide a builder for ErrorResponse
.
vpavic, eddumelendez and sergey-morenets
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement