ErrorHandlers
. Error handling is a particularly tedious to get right because by definition errors are hard to predict and to reproduce.
Please take the time to contact the author in case you discover that errors are not properly handled. You are most welcome to suggest new error handling policies or criticize existing policies. @author Ceki Gülcü
ErrorHandler
defines the interface of the service used by the Sling to handle calls to HttpServletResponse.sendError
and to handle uncaught Throwable
s.
If constructed with an instance of {@link java.util.logging.Logger}errors will be logged.
@author Justin Deoliveira, The Open Planning ProjectUsers can implement this interface in their own classes to define their own error handling behaviour. This class is created using an ErrorHandlerFactory. The factory is invoked once per request, before the action is processed. See {@link ErrorHandlerFactory}.
@author Luis AntunesIf a CSS application needs to implement customized error handling, it must implement this interface and then register an instance with the CSS parser using the parser's setErrorHandler method. The parser will then report all errors and warnings through this interface.
The parser shall use this interface instead of throwing an exception: it is up to the application whether to throw an exception for different types of errors and warnings. Note, however, that there is no requirement that the parser continue to provide useful information after a call to fatalError (in other words, a CSS driver class could catch an exception and report a fatalError).
The HandlerBase class provides a default implementation of this interface, ignoring warnings and recoverable errors and throwing a SAXParseException for fatal errors. An application may extend that class rather than implementing the complete interface itself.
@version $Revision: 1.2 $ @author Philippe Le HegaretIf a SAX application needs to implement customized error handling, it must implement this interface and then register an instance with the XML reader using the {@link org.xml.sax.XMLReader#setErrorHandler setErrorHandler}method. The parser will then report all errors and warnings through this interface.
WARNING: If an application does not register an ErrorHandler, XML parsing errors will go unreported, except that SAXParseExceptions will be thrown for fatal errors. In order to detect validity errors, an ErrorHandler that does something with {@link #error error()} calls must be registered.
For XML processing errors, a SAX driver must use this interface in preference to throwing an exception: it is up to the application to decide whether to throw an exception for different types of errors and warnings. Note, however, that there is no requirement that the parser continue to report additional errors after a call to {@link #fatalError fatalError}. In other words, a SAX driver class may throw an exception after reporting any fatalError. Also parsers may throw appropriate exceptions for non-XML errors. For example, {@link XMLReader#parse XMLReader.parse()} would throwan IOException for errors accessing entities or the document.
@since SAX 1.0 @author David Megginson @version 2.0.1+ (sax2r3pre1) @see org.xml.sax.XMLReader#setErrorHandler @see org.xml.sax.SAXParseException
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|