Thread overview
[D-runtime] [D-Programming-Language/druntime] a46f58: Changed Throwable.toString to only print the curre...
Apr 13, 2011
Jonathan M Davis
Apr 13, 2011
Sean Kelly
April 13, 2011
Branch: refs/heads/master
Home:   https://github.com/D-Programming-Language/druntime

Commit: a46f582888f04d5e96be628441501a9a88822905
    https://github.com/D-Programming-Language/druntime/commit/a46f582888f04d5e96be628441501a9a88822905
Author: Sean Kelly <sean at invisibleduck.org>
Date:   2011-04-13 (Wed, 13 Apr 2011)

Changed paths:
  M src/object_.d
  M src/rt/dmain2.d

Log Message:
-----------
Changed Throwable.toString to only print the current exception, not the entire chain.  Also added support for Error.bypassedException in the uncaught exception display code.


Commit: c2fe16a41686ebca9402af34377756b3b078d48a
    https://github.com/D-Programming-Language/druntime/commit/c2fe16a41686ebca9402af34377756b3b078d48a
Author: Sean Kelly <sean at invisibleduck.org>
Date:   2011-04-13 (Wed, 13 Apr 2011)

Changed paths:
  M changelog.dd
  R import/std/intrinsic.di
  M posix.mak
  M src/core/bitop.d
  M src/gc/gcbits.d
  M src/object_.d
  M src/rt/deh2.d
  M win32.mak

Log Message:
-----------
Merge branch 'master' of github.com:D-Programming-Language/druntime


Compare: https://github.com/D-Programming-Language/druntime/compare/377ab2c...c2fe16a
April 13, 2011
> Branch: refs/heads/master
> Home: https://github.com/D-Programming-Language/druntime
> 
> Commit: a46f582888f04d5e96be628441501a9a88822905
> 
> https://github.com/D-Programming-Language/druntime/commit/a46f582888f04d5e 96be628441501a9a88822905 Author: Sean Kelly <sean at invisibleduck.org> Date: 2011-04-13 (Wed, 13 Apr 2011)
> 
> Changed paths:
> M src/object_.d
> M src/rt/dmain2.d
> 
> Log Message:
> -----------
> Changed Throwable.toString to only print the current exception, not the entire chain. Also added support for Error.bypassedException in the uncaught exception display code.

When an exception gets printed on the command line because it escaped main, it really should be printing the whole chain (which, unfortunately, it's never done in my experience). Does making toString print only one exception make it so that escaped exceptions will only end up with the one exception being printed instead of the whole chain, or are the Throwables specifically iterated over to print the whole chain? It would probably be best to have toString print just that Throwable and then have the handler iterate through all of the Throwables in the chain, but I'd very much like to see the whole chain getting printed and I hope that this change does not work against that.

- Jonathan M Davis
April 13, 2011
On Apr 13, 2011, at 3:54 PM, Jonathan M Davis wrote:

>> Changed Throwable.toString to only print the current exception, not the entire chain. Also added support for Error.bypassedException in the uncaught exception display code.
> 
> When an exception gets printed on the command line because it escaped main, it really should be printing the whole chain (which, unfortunately, it's never done in my experience). Does making toString print only one exception make it so that escaped exceptions will only end up with the one exception being printed instead of the whole chain, or are the Throwables specifically iterated over to print the whole chain? It would probably be best to have toString print just that Throwable and then have the handler iterate through all of the Throwables in the chain, but I'd very much like to see the whole chain getting printed and I hope that this change does not work against that.

It's always printed the entire chain for me.  What was broken until recently was the chaining itself, but that's been fixed.  If printing the chain of exceptions doesn't work for you with the latest druntime, give me a test case and platform type to verify (though platform shouldn't matter--that code isn't versioned).

I changed the behavior of toString because it should really only print info on the current object.  What I did to replace the old functionality was explicitly iterate across the chain in src/rt/dmain2.d, so toString isn't called any more.  This may still not be right--it's possible that I should iterate across the exceptions and print the result of toString for each one.  But that risks an inconsistent exception trace if the user has overridden toString.  For now I decided to go with consistent output.