Re: LS: Last minute comments on CR

On Sun, 2003-11-30 at 16:31, Sander Bos wrote:
> What happens if as a user I do not bother to set an error handler, and
> IOExceptions occur. Maybe a core issue but they don't have that many
> IOException (or other serious caught Exceptions that can seemingly
> dissappear into thin air) opportunities like LS has. The more I think about
> it the stranger I think it is a Load/ Save spec defines so little in the way
> of error handling. Am I missing something?
> So what happens in case of an IOException, it's wrapped in a DOMError (where
> the exception is an object in the Java binding...) and gets passed to the
> error handler but that thing can't even rethrow it (because no throws is
> defined for handleError, and IOException is a caught exception).So far we
> cheated in our implementation (still had DOMSystemException, I figured the
> error handling stuff would be changed), and threw the original exception
> when no error-handler was set.
> Again I may be missing something but the way I interpret the spec now if I
> do
>   Document willThisBeNull =
> implementation.createLSParser(....).parseURI("file:///c:/does_not_exist.xml"
> );
> I get no exception? DOMError on core says "A SEVERITY_FATAL_ERROR will cause
> the normal processing to stop and the return value of
> DOMErrorHandler.handleError() is ignored". Okay, so we stop processing, but
> what does that mean? Not a DOMException I suppose?

After looking at that one, we decided the following changes:
- introduce a LSException with 2 exception codes: PARSE_ERR, and
SERIALIZE_ERR.

[[
Parser or write operations may throw an LSException if the processing is
stopped. The processing can be stopped due to a DOMError with a severity
of DOMError.SEVERITY_FATAL_ERROR or a non recovered
DOMError.SEVERITY_ERROR, or if DOMErrorHandler.handleError() returned
false. 

Note: As suggested in the definition of the constants in the DOMError
interface, a DOM implementation may choose to continue after a fatal
error, but the resulting DOM tree is then implementation dependent. 
]]

parse and write methods can throw PARSE_ERR and SERIALIZE_ERR exceptions
respectively. 
We receiving a LSException, DOM applications should attach a
DOMErrorHandler using the parameter "error-handler" if they wish to get
details on the error.

Philippe

Received on Friday, 9 January 2004 17:15:39 UTC