Skip to content

Commit

Permalink
fix #2839 Adjust API response to conditionally include exception mess…
Browse files Browse the repository at this point in the history
…ages based on configuration.
  • Loading branch information
marevol committed Aug 15, 2024
1 parent 59dbbd6 commit ec63857
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,16 @@ public void process(final HttpServletRequest request, final HttpServletResponse
throw new WebApiException(HttpServletResponse.SC_FORBIDDEN, "Invalid session.");
});
} catch (final WebApiException e) {
logger.debug("Failed to access to Web API.", e);
response.sendError(e.getStatusCode(), e.getMessage());
String message;
if (Constants.TRUE.equalsIgnoreCase(ComponentUtil.getFessConfig().getApiJsonResponseExceptionIncluded())) {
logger.warn("Failed to access to Web API.", e);
message = e.getMessage();
} else {
final String errorCode = UUID.randomUUID().toString();
message = "[" + errorCode + "] Failed to access to Web API.";
logger.warn(message, e);
}
response.sendError(e.getStatusCode(), message);
}
}

Expand Down

0 comments on commit ec63857

Please sign in to comment.