diff --git a/src/main/java/org/codelibs/fess/api/engine/SearchEngineApiManager.java b/src/main/java/org/codelibs/fess/api/engine/SearchEngineApiManager.java index 4673ea3d0..a37d425b7 100644 --- a/src/main/java/org/codelibs/fess/api/engine/SearchEngineApiManager.java +++ b/src/main/java/org/codelibs/fess/api/engine/SearchEngineApiManager.java @@ -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); } }