Skip to content

Commit

Permalink
Merge branch 'EA-3566_externalization_log2j_config' into
Browse files Browse the repository at this point in the history
EA-3567-new-error-responses
  • Loading branch information
gsergiu committed Oct 9, 2023
2 parents 95c1287 + 9eeb3d5 commit 94b909a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ private ResponseEntity<EuropeanaApiErrorResponse> buildApiErrorResponse(European
.setError(e.getResponseStatus().getReasonPhrase())
.setMessage(e.doExposeMessage() ? buildResponseMessage(e, i18nKey, i18NParams) : null)
// code only included in JSON if a value is set in exception
.setCode(e.getErrorCode()).build();
.setCode(e.getErrorCode())
.setSeeAlso(getSeeAlso())
.build();
return ResponseEntity.status(e.getResponseStatus()).headers(createHttpHeaders(httpRequest))
.body(response);
}
Expand Down Expand Up @@ -95,7 +97,9 @@ public ResponseEntity<EuropeanaApiErrorResponse> handleCommonHttpException(
.setError(e.getStatus().getReasonPhrase())
.setMessage( i18nService.getMessage(e.getI18nKey(), e.getI18nParams()))
// code only included in JSON if a value is set in exception
.setCode(e.getI18nKey()).build();
.setCode(e.getI18nKey())
.setSeeAlso(getSeeAlso())
.build();
return ResponseEntity.status(e.getStatus()).headers(createHttpHeaders(httpRequest))
.body(response);
}
Expand All @@ -111,7 +115,10 @@ public ResponseEntity<EuropeanaApiErrorResponse> handleNoHandlerFoundException(
EuropeanaApiErrorResponse response =
new EuropeanaApiErrorResponse.Builder(httpRequest, e, stackTraceEnabled())
.setStatus(HttpStatus.NOT_FOUND.value())
.setError(HttpStatus.NOT_FOUND.getReasonPhrase()).setMessage(e.getMessage()).build();
.setError(HttpStatus.NOT_FOUND.getReasonPhrase())
.setMessage(e.getMessage())
.setSeeAlso(getSeeAlso())
.build();
return ResponseEntity.status(HttpStatus.NOT_FOUND.value())
.contentType(MediaType.APPLICATION_JSON).body(response);
}
Expand Down
1 change: 1 addition & 0 deletions translation-web/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ server.port = 8080
server.error.include-message=always
server.error.include-stacktrace=on_param
server.error.include-exception=false
server.error.see-also=https://pro.europeana.eu/page/apis

# compression:
# enabled: true
Expand Down

0 comments on commit 94b909a

Please sign in to comment.