www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Exception tracking

Maybe I haven't compleatly understood D's Exception system.
There seems to be no equivialent to Java's stack trace functions. I'd like to
access at
least the origin of the original Exception from within the application itself.

Using "assert(0)" and the code below allows basic origin tracking.

# class AssertError : Error {
# ...
#     public uint* getLineNum(){
#         return &linnum;
#     }
#     public char[] getLineNum(){
#         return linnum;
#     }
# ...
# }

I'd realy like to have linenum and filename information available for _every_
Exception.

Sidenode: dmd/src/dmd/func.c and dmd/html/d/dbc.html (line 168-199) indicate
that there was
a mechanism to anounce the kind of Exceptions that might be thrown by a
function. Why has
this feature been droped? Is it possible to re-enable this in GDC?

Thomas
Jan 22 2005