Re: catch unexcepted

Tech-Archive recommends: Fix windows errors by optimizing your registry



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 place
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: Validating file names
    ... running Novel, from your G: running Linux file system, from your H: running ... I am not saying one does not exist! ... file file and handle any exceptions that were thrown. ... If an exception is thrown then the specified ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Using an ActiveX ocx control on a Webform
    ... > download the ActiveX I can Automate the ActiveX object through the ... > Exception of type InvalidActiveXStateException was thrown. ... > tried using the item in the design mode of a regular .NET Windows ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Exception-Objekt freigeben
    ... When an exception is thrown, the exception object that is thrown is destroyed ... we have added the AcquireExceptionObject and ReleaseExceptionObject functions. ... then the thrown object is not destroyed by the RTL, but assumed to be in control ...
    (de.comp.lang.delphi.misc)
  • Re: exception handling in complex Python programs
    ... errors possibly thrown by open, or leave it to the caller? ... def do_something: ... have to couple the exception type with the function --- between file ... Python 3 and an IOError is thrown in the other three cases <bashes ...
    (comp.lang.python)
  • Re: how to change method return type from void to boolean
    ... Will the method return in case of exception thrown ... final OperationListener operationListener) { ... However my problem is that I need to determine what was wrong and show it to the user (in gui layer). ...
    (comp.lang.java.programmer)