[phobos] Printing exceptions

David Simcha dsimcha at gmail.com
Wed Apr 7 09:37:47 PDT 2010


IMHO the reasonable default if a program crashes due to a completely
unexpected exception is for the stack trace to be printed.  Therefore, yes,
toString should add the stack trace.

On Wed, Apr 7, 2010 at 12:36 PM, Sean Kelly <sean at invisibleduck.org> wrote:

> Related question: should toString add the stack trace or not?
>
> On Apr 7, 2010, at 8:39 AM, Andrei Alexandrescu wrote:
>
> > At what point do you need to print exceptions in runtime? Is that if an
> exception leaves main()?
> >
> > Andrei
> >
> > On 04/07/2010 10:29 AM, Sean Kelly wrote:
> >> The runtime can do one of two things: print exceptions according to a
> standard format and inject the msg field in the proper place or it can call
> toString.  Which should be done?  I prefer the former because it makes for a
> standard presentation and doesn't risk allocating memory needlessly, but I
> can see how people might do fancy stuff in toString that they expect to be
> used instead.  This came up because I'm adding a default stack trace
> handler, and the current behavior prints the stack trace twice, so something
> needs to change.
> >> _______________________________________________
> >> phobos mailing list
> >> phobos at puremagic.com
> >> http://lists.puremagic.com/mailman/listinfo/phobos
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20100407/761633fb/attachment-0001.html>


More information about the phobos mailing list