Re: Saxon exception in core Calabash interface

On 1 September 2011 14:27, Norman Walsh wrote:
> Florent Georges writes:

>>   Why not defining an XProcException or CalabashException?

> Because SaxonApiException is a checked exception.  I suppose I
> could remove it from XProcRunnable, but then every
> implementation will have to add an explicit try/catch block.
> Blech.

  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.

  My concern was about something like the following:

    try {
        use, say, marklogic
    }
    catch ( marklogic exception ) {
        throw new SaxonApiException("feels weird"):
    }

  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.

> Tell you what, I'll do better in V2, ok? :-)

  Even better?  You bet I'm ok :-)

-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/

Received on Thursday, 1 September 2011 13:42:12 UTC