C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

To catch a runtime check failure...

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Erik Norman
Guest





PostPosted: Sat Oct 11, 2003 4:07 pm    Post subject: To catch a runtime check failure... Reply with 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");
}

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





PostPosted: Sun Oct 12, 2003 12:39 am    Post subject: Re: To catch a runtime check failure... Reply with quote



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





PostPosted: Thu Oct 16, 2003 8:43 pm    Post subject: Re: To catch a runtime check failure... Reply with quote



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





PostPosted: Sun Oct 19, 2003 8:00 am    Post subject: Re: To catch a runtime check failure... Reply with quote

"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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.