Line number of Exception instantiation

Nick Sabalausky a at a.a
Thu Mar 4 12:29:15 PST 2010


"bearophile" <bearophileHUGS at lycos.com> wrote in message 
news:hmovte$2431$1 at digitalmars.com...
> What do you think of the idea of the Exception to remember (so later it 
> can be shown if uncaught) the line number and file name where it was 
> instantiated?
>
> void foo() {
>    auto e = new Exception(""); // instantiation line number here
>    throw e;
> }
> void main() {
>    foo();
> }
>
> Exceptions get caught, rethrown, stored, etc. But in many cases in my code 
> they are instantiated close to where the cause was. So knowing such line 
> number can be useful (if you are using a debugger this is not so useful).
>
> Bye,
> bearophile

Doesn't tango's exception tracing do that?





More information about the Digitalmars-d mailing list