Jump to page: 1 2 3
Thread overview
[Issue 12558] try/catch allows implicit catching of Throwables without specifying any Exception type
Apr 11, 2014
Andrej Mitrovic
Apr 11, 2014
Andrej Mitrovic
Apr 12, 2014
yebblies
Apr 12, 2014
Andrej Mitrovic
Apr 19, 2014
Nick Treleaven
Apr 21, 2014
Vladimir Panteleev
Apr 21, 2014
Andrej Mitrovic
Apr 21, 2014
Andrej Mitrovic
[Issue 12558] try/catch allows implicit catching of Errors without specifying any Exception type
Aug 23, 2014
Andrej Mitrovic
Nov 27, 2014
Martin Nowak
Nov 27, 2014
Vladimir Panteleev
Oct 08, 2015
Vladimir Panteleev
Oct 08, 2015
Andrej Mitrovic
Oct 11, 2015
Andrej Mitrovic
Apr 25, 2016
Nick Treleaven
May 06, 2016
Andrej Mitrovic
April 11, 2014
https://issues.dlang.org/show_bug.cgi?id=12558

Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|try/catch allows implicit   |try/catch allows implicit
                   |catching of Throwables      |catching of Throwables
                   |without specify any         |without specifying any
                   |Exception type              |Exception type

--
April 11, 2014
https://issues.dlang.org/show_bug.cgi?id=12558

--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
(In reply to Andrej Mitrovic from comment #0)
> $ dmd -run test.d
> > Caught a Throwable

Technically it caught an Error (AssertError), but anywho..

--
April 12, 2014
https://issues.dlang.org/show_bug.cgi?id=12558

yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies@gmail.com

--- Comment #2 from yebblies <yebblies@gmail.com> ---
I dunno, catching asserts like that is useful.  Why shouldn't the default be to catch absolutely everything?

--
April 12, 2014
https://issues.dlang.org/show_bug.cgi?id=12558

--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
(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.

But we already have library workarounds for exactly this purpose, e.g. collectException!Throwable( your_stuff_here );

--
April 19, 2014
https://issues.dlang.org/show_bug.cgi?id=12558

Nick Treleaven <ntrel-public@yahoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ntrel-public@yahoo.co.uk

--- Comment #4 from Nick Treleaven <ntrel-public@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.

--
April 21, 2014
https://issues.dlang.org/show_bug.cgi?id=12558

Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow@gmail.com

--
April 21, 2014
https://issues.dlang.org/show_bug.cgi?id=12558

Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                URL|                            |https://github.com/D-Progra
                   |                            |mming-Language/dmd/pull/348
                   |                            |2
           Assignee|nobody@puremagic.com        |andrej.mitrovich@gmail.com

--
April 21, 2014
https://issues.dlang.org/show_bug.cgi?id=12558

monarchdodra@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra@gmail.com

--- Comment #5 from monarchdodra@gmail.com ---
"catch" should only be catching exceptions, for the same reason that "nothrow" only makes promises about exceptions.

Errors (or more generally Throwables) are NOT the standard, and should always be dealt with explicitly.

Besides, how hard is it to just write: "catch(Throwbale)"

--
April 21, 2014
https://issues.dlang.org/show_bug.cgi?id=12558

--- Comment #6 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
(In reply to monarchdodra from comment #5)
> Besides, how hard is it to just write: "catch(Throwbale)"

The general rule is: When there's a way to abuse the system, it /will/ be abused.

The only reason why I found out about this feature is because it's used in the dub project. I was surprised it even compiled, and doubly-surprised that it's actually catching Throwables.

--
June 06, 2014
https://issues.dlang.org/show_bug.cgi?id=12558

briancschott@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |briancschott@gmail.com
             Blocks|                            |10247

--- Comment #7 from briancschott@gmail.com ---
DMD can't even parse this syntax correctly. I also support removing it.

--
« First   ‹ Prev
1 2 3