Re: Saxon exception in core Calabash interface

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,
                                          norm

-- 
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676
www.marklogic.com

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