W3C home > Mailing lists > Public > xproc-dev@w3.org > September 2011

Re: Saxon exception in core Calabash interface

From: Norman Walsh <ndw@nwalsh.com>
Date: Thu, 01 Sep 2011 11:00:07 -0400
To: XProc Dev <xproc-dev@w3.org>
Message-ID: <m2y5y8jojs.fsf@nwalsh.com>
Florent Georges <fgeorges@fgeorges.org> writes:
>   Ok, I think I understand...  Because this exception has become the
> exception thrown by most of the Calabash machinery, even if you don't
> use Saxon directly you are actually using it through e.g.
> ReadablePipe.read().  I guess the Object-Oriented Principles (or Java
> usual practices?) would say to rather define your own checked
> exception and stack inner exceptions into your new exception.

I think the general feeling is that checked exceptions are a bad idea.

>   My concern was about something like the following:
>     try {
>         use, say, marklogic
>     }
>     catch ( marklogic exception ) {
>         throw new SaxonApiException("feels weird"):
>     }

Yikes! Don't do that!

  throw new XProcException("this feels right")

The XProcException is a runtime exception (not a checked exception) so
you can always throw it. You only have to declare checked exceptions.
I declare SaxonApiException because, as you observe, many of the
underlying Saxon methods declare it.

>   But in the meanwhile, I discovered that XProcException is a
> non-checked exception, so you can always throw one from run().  So
> that's ok I guess.

Right! (Note to self: read whole message before starting to type your
reply. :-) )

                                        Be seeing you,

Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676

Received on Thursday, 1 September 2011 15:00:36 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:03:08 UTC