printing Throwables in druntime
David
d at dav1d.de
Sun Oct 21 08:03:13 PDT 2012
currently the class Throwable has a member toString which basically
generates the pretty stacktrace:
https://github.com/D-Programming-Language/druntime/blob/master/src/object_.d#L1337
Now, I tried to override that toString function to get my own
Exception-Body, but it just didn't call my overriden toString, so
looking at rt/dmain.d where the Exceptions are print:
https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dmain2.d#L530
The Throwable.toString method is never used, but basically reimplemented
in these print* functions.
What hinders us from replacing:
`print(t);`
with:
`console(t.toString())`?
The only difference I can see is the "bypassed" exception-stuff, but I
would rather implement that in Throwable.toString. This would also fix
my problem of not beeing able to change the body of an Exception.
More information about the Digitalmars-d
mailing list