Re: override toString of Exception

2012-10-21 Thread Ali Çehreli
On 10/21/2012 01:51 PM, David wrote: 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 > except

Re: override toString of Exception

2012-10-21 Thread David
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 t

Re: override toString of Exception

2012-10-21 Thread 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

Re: override toString of Exception

2012-10-21 Thread Ali Çehreli
On 10/20/2012 09:42 AM, David wrote: class BraLaException : Exception { this(string s, string f=__FILE__, size_t l=__LINE__) { super(s, f, l); } override string toString() { return "bar"; } } when throwing this exception, I still get the stacktrace and not "bar", is it possible to change that

Re: override toString of Exception

2012-10-21 Thread David
when throwing this exception, I still get the stacktrace and not "bar", is it possible to change that behaviour? Perhaps this function can help: http://dlang.org/phobos/core_runtime.html#traceHandler Unfortunatly not, it expects a function which returns TraceInfo, but I simply wanna modify t

Re: override toString of Exception

2012-10-20 Thread Jacob Carlborg
On 2012-10-20 18:42, David wrote: class BraLaException : Exception { this(string s, string f=__FILE__, size_t l=__LINE__) { super(s, f, l); } override string toString() { return "bar"; } } when throwing this exception, I still get the stacktrace and not "b

override toString of Exception

2012-10-20 Thread David
class BraLaException : Exception { this(string s, string f=__FILE__, size_t l=__LINE__) { super(s, f, l); } override string toString() { return "bar"; } } when throwing this exception, I still get the stacktrace and not "bar", is it possible to change that behav