[jsword-devel] Exception bubbling

Chris Burrell christopher at burrell.me.uk
Wed Mar 2 14:58:15 MST 2011


I'm not sure I agree about backwards compatibility...

Can't we in the first instance change the LucidException to extend a
RuntimeException. Then all the apps currently handling the exception can
still handle it. Secondly we change the method signature. And still the
existing apps could catch these exceptions. I believe you can catch any type
of RuntimeException, whenever you like. So existing apps would be fine? The
only think you can't do is to catch a checked exception that is not
declared... (or of course not catch a declared exception).

So for example, existing code catching a NoSuchVerseException will
effectively be catching a different type of object, but it is still an
exception and still valid to be caught...

Chris


On 2 March 2011 21:50, Martin Denham <mjdenham at gmail.com> wrote:

> I tend to use RuntimeExceptions with web apps where there are clearly
> defined entry points to catch all exceptions and inform the user.  I took a
> slightly different approach when using JSword but found I still needed the
> top level try/catch blocks that I used with RuntimeExceptions but also
> needed the try/catch in the code for the sake of JSword's checked
> exceptions.
>
> Prof Martin Odersky would totally agree with you because in Scala all
> exceptions are RuntimeExceptions.
>
> The only problem I can see is it would not be easy to retain backward
> compatibility so as not to break existing apps.
>
> Regards
> Martin
>
>
>
> On 27 February 2011 10:41, Chris Burrell <chris at burrell.me.uk> wrote:
>
>> Hi
>>
>> Can I assume that exception handling in JSword is all be done via a
>> LucidException? It doesn't look like LucidRuntimeExceptions are being used
>> much...
>>
>> I myself would prefer to be handling RuntimeException (i.e.
>> LucidRuntimeException) as that would mean less explicit handling. For
>> example, if I have someone ask for a verse that doesn't exist, my default
>> behaviour will be to stop the processing, bubble up to the top and handle it
>> there. I'd like to catch that exception as high up as possible without
>> explicitly needing to specify it on every method that it might go through -
>> clutters our code a little.
>>
>> Any thoughts?
>>
>> Cheers
>> Chris
>>
>>
>>
>>
>> _______________________________________________
>> jsword-devel mailing list
>> jsword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/jsword-devel
>>
>>
>
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20110302/dbb82ddd/attachment.html>


More information about the jsword-devel mailing list