M
Markus Dehmann
What's the best way to implement an exception stack trace? What I want
is sth like printStackTrace() in Java. It could look like this:
Car.cpp:381:runtime_exception:Could not find the brake
Police.cpp:123:traffic_observation_exception:Speed too high
Driver.cpp:2131:existential_exception:I am in jail
for the following fictitious program:
int main(){
try{
Driver me;
me.driveHome(); // starts a chain of exceptions
// of which the last one comes up here
me.watchTV();
}catch(exception& e){
cerr << e.what();
}
}
If we don't have the hierarchy, all the client sees is the last
exception, sth like "I am in jail", but that's not enough! He doesn't
know what's going on, so he needs to see the whole chain of reasons.
Thanks!
Markus
is sth like printStackTrace() in Java. It could look like this:
Car.cpp:381:runtime_exception:Could not find the brake
Police.cpp:123:traffic_observation_exception:Speed too high
Driver.cpp:2131:existential_exception:I am in jail
for the following fictitious program:
int main(){
try{
Driver me;
me.driveHome(); // starts a chain of exceptions
// of which the last one comes up here
me.watchTV();
}catch(exception& e){
cerr << e.what();
}
}
If we don't have the hierarchy, all the client sees is the last
exception, sth like "I am in jail", but that's not enough! He doesn't
know what's going on, so he needs to see the whole chain of reasons.
Thanks!
Markus