comparison dwt/dwthelper/utils.d @ 228:628e9518870e

Fix ExceptionPrintStacktrace
author Frank Benoit <benoit@tionex.de>
date Thu, 22 May 2008 19:46:10 +0200
parents 53c57b061fd9
children 5ff96efb6f4b
comparison
equal deleted inserted replaced
227:b74b74ce5c7d 228:628e9518870e
765 size_t RuntimeTotalMemory(){ 765 size_t RuntimeTotalMemory(){
766 GCStats s = gc_stats(); 766 GCStats s = gc_stats();
767 return s.poolsize; 767 return s.poolsize;
768 } 768 }
769 769
770 String ExceptionGetLocalizedMessage( Exception e ){
771 return e.msg;
772 }
770 773
771 void ExceptionPrintStackTrace( Exception e ){ 774 void ExceptionPrintStackTrace( Exception e ){
772 ExceptionPrintStackTrace( e, Stderr ); 775 ExceptionPrintStackTrace( e, Stderr );
773 } 776 }
774 void ExceptionPrintStackTrace( Exception e, Print!(char) print ){ 777 void ExceptionPrintStackTrace( Exception e, Print!(char) print ){
775 Exception exception = e; 778 Exception exception = e;
776 while( exception !is null ){ 779 while( exception !is null ){
777 print.formatln( "Exception in {}({}): {}", exception.file, exception.line, exception.msg ); 780 print.formatln( "Exception in {}({}): {}", exception.file, exception.line, exception.msg );
778 foreach( msg; exception.info ){ 781 if( exception.info !is null ){
779 print.formatln( "trc {}", msg ); 782 foreach( msg; exception.info ){
783 print.formatln( "trc {}", msg );
784 }
780 } 785 }
781 exception = exception.next; 786 exception = exception.next;
782 } 787 }
783 } 788 }
784 789