Thread overview
[Issue 4223] New: Throwing exception in finally block hides original exception
May 23, 2010
nfxjfg@gmail.com
Jan 07, 2011
nfxjfg@gmail.com
Jan 07, 2011
Gide Nwawudu
Jan 07, 2011
Don
Jan 08, 2011
Gide Nwawudu
May 23, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4223

           Summary: Throwing exception in finally block hides original
                    exception
           Product: D
           Version: 2.041
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: nfxjfg@gmail.com


--- Comment #0 from nfxjfg@gmail.com 2010-05-23 02:42:52 PDT ---
The message for assertion "a" will never be displayed, even though it certainly fails:

void main() {
    try {
        assert(false, "a");
    } finally {
        assert(false, "b");
    }
}

Executing this program should display messages for both cases. Otherwise, it may be impossible to tell what actually failed: assertion b may depend on cleanup code that was supposed to be executed after assertion a. It is not unusual that other, seemingly unrelated, assertions fail once the program's state is "corrupted".

Suggested fix: link the exceptions via Throwable.next.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 07, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4223


nfxjfg@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 07, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4223


Gide Nwawudu <gide@nwawudu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic, wrong-code
             Status|RESOLVED                    |REOPENED
                 CC|                            |gide@nwawudu.com
         Resolution|WONTFIX                     |


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 07, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4223


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |bugzilla@digitalmars.com


--- Comment #1 from Andrei Alexandrescu <andrei@metalanguage.com> 2011-01-07 13:57:15 PST ---
This is an important matter. We don't want under any circumstances to irretrievably lose information. nfxjfg@gmail.com, I understand you may be frustrated by the slow response, but please don't undo the valuable work you've put into reporting these bugs. Thanks.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 07, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4223


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2011-01-07 14:08:06 PST ---
(In reply to comment #1)
> This is an important matter. We don't want under any circumstances to irretrievably lose information. nfxjfg@gmail.com, I understand you may be frustrated by the slow response, but please don't undo the valuable work you've put into reporting these bugs. Thanks.

It's particularly ironic -- this bug was actually fixed.
(Fixed in DMD 2.048).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 08, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4223


Gide Nwawudu <gide@nwawudu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #3 from Gide Nwawudu <gide@nwawudu.com> 2011-01-07 17:10:14 PST ---
Looks fixed.

C:\>type bug4223.d
void main() {
    try {
        assert(false, "a");
    } finally {
        assert(false, "b");
    }
}

C:\>dmd bug4223.d

C:\>bug4223
core.exception.AssertError@bug4223.d(5): b
core.exception.AssertError@bug4223.d(3): a

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------