 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Erik Norman Guest
|
Posted: Sat Oct 11, 2003 4:07 pm Post subject: To catch a runtime check failure... |
|
|
Hi all,
I fail to catch run-time check errors in my code in the right place.
I always end up in my catch(...) function. Instead, I need to be able
to identify what exception type that occured. (I do not use any own
throw commands.)
Please help!
my code (simplified):
catch ( CException & e) { //MFC base top class(?)
logger("CException handler");
}
catch( exception ) { // standard c++ top class(?)
logger("Exception handler");
}
catch (...){
logger("-default exception handler");
}
Erik
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Severin Ecker Guest
|
Posted: Sun Oct 12, 2003 12:39 am Post subject: Re: To catch a runtime check failure... |
|
|
hi!
| Quote: | I always end up in my catch(...) function. Instead, I need to be able
to identify what exception type that occured. (I do not use any own
throw commands.)
My guess is, that some function you use throws an exception that's not |
derrived from CException or exception.
I would suggest that you check out the function-documentation if there
are
any hints about the exceptions used. If not, I can't think of any
possibility to get info about the exception.
regards,
sev
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
WW Guest
|
Posted: Thu Oct 16, 2003 8:43 pm Post subject: Re: To catch a runtime check failure... |
|
|
Erik Norman wrote:
| Quote: | Hi all,
I fail to catch run-time check errors in my code in the right place.
I always end up in my catch(...) function. Instead, I need to be able
to identify what exception type that occured. (I do not use any own
throw commands.)
Please help!
my code (simplified):
catch ( CException & e) { //MFC base top class(?)
logger("CException handler");
}
|
The above is Microsoft MFC specific, you need to ask about it form
Microsoft
| Quote: | catch( exception ) { // standard c++ top class(?)
|
Nope. It is std::exception. If you happen to have something called
exception (a visible name, other than the std::exception) you will not
catch
standard exceptions.
How did you test that you are not catching the exceptions? I mean did
you
run under the debugger and it told you there was standard/MFC exception
thrown?
--
WW aka Attila
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Michiel Salters Guest
|
Posted: Sun Oct 19, 2003 8:00 am Post subject: Re: To catch a runtime check failure... |
|
|
"Erik Norman" <carl_erik.norman (AT) comhem (DOT) se> wrote in
news:2UPhb.32438$dP1.101004 (AT) newsc (DOT) telia.net:
| Quote: | Hi all,
I fail to catch run-time check errors in my code in the right place.
I always end up in my catch(...) function. Instead, I need to be able
to identify what exception type that occured. (I do not use any own
throw commands.)
|
I suspect you might have encountered Microsoft's Structured Exception
Handling. This throws on null pointer use (MS->Access Violations) and lots
of other undefined behavior. It is a conforming extension in that regards.
IIRC, Run-time check errors are similar implementations of behavior that
the standard left to the compiler vendors. Therefore you must check your
compiler documentation. Assuming MSVC again, that would be the MSDN
collection.
HTH,
--
Michiel Salters
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|