[phobos] Printing exceptions

Robert Clipsham robert at octarineparrot.com
Wed Apr 7 08:53:14 PDT 2010


On 07/04/10 16:29, 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.

I think the better option would be to print them in the standard format, 
at least by default. You could always include several trace handlers to 
allow the user to effortlessly pick the handler they want, rather than 
everyone implementing their own for when they want to use toString.



More information about the phobos mailing list