www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - exception in ExceptionPrintStackTrace

reply Bill Baxter <dnewsgroup billbaxter.com> writes:
This in dwt.dwthelper.utils.d:

void ExceptionPrintStackTrace( Exception e, Print!(char) print ){
     Exception exception = e;
     while( exception !is null ){
         print.formatln( "Exception in {}({}): {}", exception.file, 
exception.line, exception.msg );
             foreach( msg; exception.info ){
                 print.formatln( "trc {}", msg );
             }
         exception = exception.next;
     }
}

itself generates exceptions for me because exception.info is null.
I think maybe it's because I don't have a stacktrace patch installed for 
Tango?  In any event a check for null before trying to access 
exception.info would be nice there.

--bb
May 21 2008
parent Frank Benoit <keinfarbton googlemail.com> writes:
Bill Baxter schrieb:
 This in dwt.dwthelper.utils.d:
 
 void ExceptionPrintStackTrace( Exception e, Print!(char) print ){
     Exception exception = e;
     while( exception !is null ){
         print.formatln( "Exception in {}({}): {}", exception.file, 
 exception.line, exception.msg );
             foreach( msg; exception.info ){
                 print.formatln( "trc {}", msg );
             }
         exception = exception.next;
     }
 }
 
 itself generates exceptions for me because exception.info is null.
 I think maybe it's because I don't have a stacktrace patch installed for 
 Tango?  In any event a check for null before trying to access 
 exception.info would be nice there.
 
 --bb
Thanks, i fixed that.
May 22 2008