override toString of Exception

David d at dav1d.de
Sun Oct 21 13:51:14 PDT 2012


Am 21.10.2012 22:46, schrieb David:>  > This behavior makes sense to me 
because printing the backtrace should
 >  > concern the application, not the exception itself. If the application
 >  > does not want the backtrace printed, it can handle all of the
 > exceptions.
 >  >
 >  > Ali
 >
 > I just want to add color to my exceptions and the easiest way is to
 > override toString, that is not possible since, the printing-code in
 > druntime doesn't call exception.toString, but reimplements it's default
 > behaviour.
 >
 > I "fixed" it:
 > https://github.com/D-Programming-Language/druntime/pull/331

Well, it can be used to way more than only coloring the exception, you 
can also provide additional information etc. and I think it makes more 
sense, why is there a toString implemented if it isn't used.


More information about the Digitalmars-d-learn mailing list