Re: catch unexcepted
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Thu, 18 Sep 2008 09:40:51 -0400
Exceptions are caught when they are thrown by a lower-level function which has been
called. That is, you have to be above the exception point to do a catch.
If an exception is being thrown, it means you have a problem. You should fix the cause of
the exception.
Note that all exceptions that are derived from CException are caught in the MFC
message-pump logic. So if you need to catch them without letting the annoying MFC
MessageBox pop up saying the exception was not caught, you have to have try/catch at every
point that can be dispatched.
You can also set an exception handler routine that intercepts all exception calls, using
SetUnhandledExceptionFilter, but note that in MFC, *ALL* CException-derived exceptions
*are* handled in the MFC logic, so the filter would never be called.
If you are just trying to debug why the exceptions are happening, you can go to the
Debug>Exceptions item in the VS menu and tell it that you want to enter the debugger when
an exception is thrown.
But the concept of "one place" violates the fundamental design of the exception mechanism,
which is to catch exceptions thrown by lower-level functions.
joe
On Wed, 17 Sep 2008 23:35:31 -0700 (PDT), raj s <yesraaj@xxxxxxxxx> wrote:
Is there any way to capture all the exception at one placeJoseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- References:
- catch unexcepted
- From: raj s
- catch unexcepted
- Prev by Date: Re: POS Printer
- Next by Date: Re: Where should I look for commercial MFC gui control packs?
- Previous by thread: Re: catch unexcepted
- Next by thread: Re: POS Printer
- Index(es):
Relevant Pages
|