Proposal: Extensible exceptions

Johan Tibell johan.tibell at
Mon Jul 7 08:02:54 EDT 2008

On Sun, Jul 6, 2008 at 10:13 PM, Henning Thielemann
<lemming at> wrote:
>  In Modula-3 you have to add the exceptions that can be raised to a
> PROCEDURE header. Java has adopted this mechanism.

Many people argue that this was a mistake [1, 2, 3, 4]. For one it
requires that you rewrap exceptions at every abstraction boundary or
expose your implementation details in the API. For example, imagine
that you decide to use an SQL database as a data store and declare
that your functions throw an SQLException. If you later change your
mind and want to use a plain file for storage you need to change your
function's type and thereby break clients that use your API. If you
don't want this to happen you have to wrap all exception in
MyException and throw that.




More information about the Libraries mailing list