Package org.apache.sling.api.servlets
Interface ErrorHandler
- 
- All Known Subinterfaces:
 ErrorHandler
@ConsumerType public interface ErrorHandlerTheErrorHandlerdefines the interface of the service used by the Sling to handle calls toHttpServletResponse.sendErrorand to handle uncaughtThrowables. 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidhandleError(int status, java.lang.String message, SlingHttpServletRequest request, SlingHttpServletResponse response)Called to render a response for a HTTP status code.voidhandleError(java.lang.Throwable throwable, SlingHttpServletRequest request, SlingHttpServletResponse response)Called to render a response for an uncaughtThrowable. 
 - 
 
- 
- 
Method Detail
- 
handleError
void handleError(int status, java.lang.String message, SlingHttpServletRequest request, SlingHttpServletResponse response) throws java.io.IOExceptionCalled to render a response for a HTTP status code. This method should set the response status and print the status code and optional message.If the response has already been committed, an error message should be logged but no further processing should take place.
- Parameters:
 status- The HTTP status code to setmessage- An optional message to write to the response. This message may benull.request- The request object providing more information on the request.response- The response object used to send the status and message.- Throws:
 java.io.IOException- May be thrown if an error occurrs sending the response.
 
- 
handleError
void handleError(java.lang.Throwable throwable, SlingHttpServletRequest request, SlingHttpServletResponse response) throws java.io.IOExceptionCalled to render a response for an uncaughtThrowable.If the response has already been committed, an error message should be logged but no further processing should take place.
- Parameters:
 throwable- TheThrowablecausing this method to be called.request- The request object providing more information on the request.response- The response object used to send the status and message.- Throws:
 java.io.IOException- May be thrown if an error occurrs sending the response.
 
 - 
 
 -