The Error Listener PreviousNext

The Error Listener receives notification of all warnings and errors (whether recoverable or not) generated when compiling the stylesheet, or produced by the XM_XSLT_TRANSFORMER.

XSLT defines some errors as recoverable (and specifies optional recovery options), and others as non-recoverable. Conditions not defined by XSLT are raised by the library as warnings.

Features

The following features may be of interest to the Eiffel programmer:

recovery_policy: INTEGER / set_recovery_policy (a_recovery_policy: like recovery_policy)
The recovery policy is an instruction to the error routine as to how to handle recoverable errors. If it evaluates to Recover_silently, then error is supposed to set recovered to True, and not issue any message (although it may choose to log the error).

If it evaluates to Recover_with_warnings, then it should additionally inform the user of the recovered condition, provided recoverable_error_threshold has not been exceeded (although it is not obliged to honour this threshold).

If, however, it evaluates to Do_not_recover, then it should inform the user of the error condition, and set recovered to False.

warning_threshold: INTEGER / set_warning_threshold (a_warning_threshold: like warning_threshold)
This threshold is available to request the warning routine not to issue an informatory message once this number of warning messages have been issued.
recoverable_error_threshold: INTEGER / set_recoverable_error_threshold (a_recoverable_error_threshold: like recoverable_error_threshold)
This threshold is available to request the error routine not to issue an informatory message once this number of recoverable errors have been seen.
warning (a_message: STRING; a_locator: XM_XPATH_LOCATOR)
This routine is called by the library to warn of problematic conditions which are not defined as errors by XSLT. It should inform the user (in some unspecified way) about the condition, provided that warning_threshold has not been exceeded (but there is no obligation to maintain a count of warning messages, so an error listener could ignore this threshold).
error (a_error: XM_XPATH_ERROR_VALUE)
This routine is called by the library to inform the user (in some unspecified way) about a recoverable error, provided that recoverable_error_threshold has not been exceeded (but there is no obligation to maintain a count of error messages, so an error listener could ignore this threshold) and perhaps recover from the error (both actions depend upon the current setting of recovery_policy).

This routine must set recovered to True if it recovers from an error, so that the transformer can take the defined recovery action.

If the error listener exposes the error code (and its namespace uri) in any way, then it must honour the error_change_stack. See XM_XSLT_DEFAULT_ERROR_LISTENER for how to do this. It may be necessary to copy the error location information.

fatal_error (a_error: XM_XPATH_ERROR_VALUE)
This routine is called by the library to inform the user (in some unspecified way) about a non-recoverable error.

If the error listener exposes the error code (and its namespace uri) in any way, then it must honour the error_change_stack. See XM_XSLT_DEFAULT_ERROR_LISTENER for how to do this. It may be necessary to copy the error location information.

treat_warnings_as_recoverable_errors
This routine may be called by the programmer on an error listener, to request the warning routine to behave identically to the error routine.

The default error listener: XM_XSLT_DEFAULT_ERROR_LISTENER

This is the chief concrete error listener provided by the library. It maintains error counts. The recovery policy is passed as an argument to the creation routine, as also is a UT_ERROR_HANDLER to receive the warning and error messages.

A testing error listener: XM_XSLT_TESTING_ERROR_LISTENER

This error listener supresses all output, but records which error message codes it has seen. It was written for use in the XSLT test suite, so as to avoid confusing the user by displaying error messages which are intentionally being produced.


Copyright 2004-2016, Colin Adams and others
mailto:colin@colina.demon.co.uk
http://www.gobosoft.com
Last Updated: 27 December 2016
HomeTocPreviousNext