[Issue 12558] try/catch allows implicit catching of Throwables without specifying any Exception type
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Apr 19 04:09:55 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12558
Nick Treleaven <ntrel-public at yahoo.co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ntrel-public at yahoo.co.uk
--- Comment #4 from Nick Treleaven <ntrel-public at yahoo.co.uk> ---
(In reply to Andrej Mitrovic from comment #3)
> (In reply to yebblies from comment #2)
> > I dunno, catching asserts like that is useful. Why shouldn't the default be
> > to catch absolutely everything?
>
> Because you're potentially drowning a serious error and it's really hard to
> spot this in the code.
Indeed, and we recommend *not* to catch Error. Doing it silently hides
important bugs.
> But we already have library workarounds for exactly this purpose, e.g.
> collectException!Throwable( your_stuff_here );
or just:
catch(Throwable){...}
Perhaps we could add a compiler warning for catch without an explicit type.
--
More information about the Digitalmars-d-bugs
mailing list