-
-
Notifications
You must be signed in to change notification settings - Fork 415
Add Throwable.toString(sink) overload #636
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope, we'll remove this file in #482 :)
I thought the plan was to remove stuff from the Object class? Note that if you already had this |
It's |
Ah, I misread. Sorry. |
src/object_.d
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buf
is dead code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx, done
Other than the small issues this LGTM. |
- Add toString(sink) overload to Throwable, so that it can be used without the GC. - Rewrite string toString() in terms of the sink overload. Thus toString(sink) becomes the preferred method to override in derived Throwables.
Add Throwable.toString(sink) overload
Thanks. |
The commit db7dc40 causes problems with unit test failures. extern (C) int printf (in char*, ...);
unittest {
printf("Reached unittest.\n");
assert(0);
printf("After failed assertion.\n");
}
void main ()
{
} The above code should print:
And a stack trace. After the above mentioned commit it only prints "Reached unittest.". See http://forum.dlang.org/thread/lgxkcylkpugpktpstpgh@forum.dlang.org#post-lgxkcylkpugpktpstpgh:40forum.dlang.org. |
Reported as: http://d.puremagic.com/issues/show_bug.cgi?id=11362. |
Argh, so we had no stack-trace tests before? Even some partial string matching could suffice. Anyway @dawgfoto, any ideas what went wrong? |
Issue URL: http://d.puremagic.com/issues/show_bug.cgi?id=11362 Regression commit from pull dlang#636: db7dc40
- The function printThrowable relied on the Throwable.toString(sink) overload from dlang#636 which is not available in 2.064. - Fixed by readding the old exception print code.
- The function printThrowable relied on the Throwable.toString(sink) overload from dlang#636 which is not available in 2.064. - Fixed by re-adding the old exception print code.
Issue URL: http://d.puremagic.com/issues/show_bug.cgi?id=11362 Regression commit from pull dlang#636: db7dc40
It looks like no one updated core.exception, so all the standard exceptions may have lost their custom error messages. The exceptions defined there all override toString() only. Also, what about exceptions defined in Phobos? Have any of those been updated to work with this new output routine? |
AFAIR this only changed how uncatched exceptions were printed, they didn't show custom messages before because it's not possible to use |
Can you please file a bugzilla ticket for this? |
Uncaught exceptions are handled before static module dtors are run and before the GC is terminated though. Custom messages should have worked up until this change. I'll file a ticket. |
Add toString(sink) overload to Throwable, so that it can be used without the GC.