Skip to content

Commit

Permalink
Fix status
Browse files Browse the repository at this point in the history
  • Loading branch information
finefuture committed Apr 2, 2024
1 parent e37f8b3 commit cdc214c
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,15 @@ protected void postOutputMessage(HttpOutputMessage outputMessage) throws Throwab
protected void preMetadata(HttpMetadata httpMetadata, HttpOutputMessage outputMessage) {}

protected final String resolveStatusCode(Object data) {
return String.valueOf(data instanceof HttpResult ? ((HttpResult<?>) data).getStatus() : HttpStatus.OK);
return data instanceof HttpResult
? String.valueOf(((HttpResult<?>) data).getStatus())
: HttpStatus.OK.getStatusString();
}

protected final String resolveStatusCode(Throwable throwable) {
return String.valueOf(
throwable instanceof HttpStatusException
? ((HttpStatusException) throwable).getStatusCode()
: HttpStatus.INTERNAL_SERVER_ERROR.getCode());
return throwable instanceof HttpStatusException
? String.valueOf(((HttpStatusException) throwable).getStatusCode())
: HttpStatus.INTERNAL_SERVER_ERROR.getStatusString();
}

protected final ErrorResponse buildErrorResponse(String statusCode, Throwable throwable) {
Expand Down

0 comments on commit cdc214c

Please sign in to comment.