fix #2694 return response body
This commit is contained in:
parent
84355e91cb
commit
3eeb8cb839
1 changed files with 3 additions and 3 deletions
|
@ -59,12 +59,12 @@ public class FessApiFailureHook implements ApiFailureHook { // #change_it for ha
|
|||
// ==============
|
||||
@Override
|
||||
public OptionalThing<ApiResponse> handleClientException(final ApiFailureResource resource, final RuntimeException cause) {
|
||||
return OptionalThing.empty(); // means empty body (HTTP status will be automatically sent)
|
||||
return OptionalThing.of(asJson(createFailureBean(Status.BAD_REQUEST, createMessage(resource, cause))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public OptionalThing<ApiResponse> handleServerException(final ApiFailureResource resource, final Throwable cause) {
|
||||
return OptionalThing.empty(); // means empty body (HTTP status will be automatically sent)
|
||||
return OptionalThing.of(asJson(createFailureBean(Status.SYSTEM_ERROR, createMessage(resource, cause))));
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
|
@ -78,7 +78,7 @@ public class FessApiFailureHook implements ApiFailureHook { // #change_it for ha
|
|||
return new ApiErrorResponse().message(message).status(status).result();
|
||||
}
|
||||
|
||||
protected String createMessage(final ApiFailureResource resource, final RuntimeException cause) {
|
||||
protected String createMessage(final ApiFailureResource resource, final Throwable cause) {
|
||||
if (!resource.getMessageList().isEmpty()) {
|
||||
return resource.getMessageList().stream().collect(Collectors.joining(" "));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue