> > Use SomeException for the type, as it is the base of the exception
> > hierarchy.
> 
> But it is usually recommended that you *don't* do this, as it even
> captures Ctrl-c invocations:

I think there are situation when it is justified to catch almost all
exceptions.  And people do that a lot, which often leads to ctrl-c not
properly working (e.g. we had this in HUnit before 1.2.4.2).  The way I
deal with this is:

    someAction `catches` [
      -- Re-throw AsyncException, otherwise execution will not terminate
      -- on SIGINT (ctrl-c).  All AsyncExceptions are re-thrown (not
      -- just UserInterrupt) because all of them indicate severe
      -- conditions and should not occur during normal operation.
      Handler (\e -> throw (e :: AsyncException)),

      Handler (\e -> yourHandler $ e :: SomeException)
      ]

Cheers,
Simon

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to