/** * Helper wrapper around {@link #maybeHandleException(Throwable, RequestInfoForLogging)} that takes in servlet * request and servlet response. The request will be wrapped in a {@link RequestInfoForLoggingServletApiAdapter} so * that it can be passed along to the method that does the work. If there are any headers in the returned {@link * ErrorResponseInfo#headersToAddToResponse} then they will be automatically added to the given servlet response, * and {@link javax.servlet.http.HttpServletResponse#setStatus(int)} will be automatically set with {@link * ErrorResponseInfo#httpStatusCode} as well. */ public ErrorResponseInfo<T> maybeHandleException( Throwable ex, HttpServletRequest servletRequest, HttpServletResponse servletResponse ) throws UnexpectedMajorExceptionHandlingError { ErrorResponseInfo<T> errorResponseInfo = maybeHandleException( ex, new RequestInfoForLoggingServletApiAdapter(servletRequest) ); if (errorResponseInfo != null) processServletResponse(errorResponseInfo, servletResponse); return errorResponseInfo; }