Ignored exceptions...

  • I am trying to add an exception handling to my application that
    catches uncaught exceptions.

    Problem is there seems to be exception handling within cocoa 'under'
    the top level, that causes exceptions to be ignored.

    If I add a delegate to the defaultExceptionHandler and
    setExceptionHandlingMask:NSLogAndHandleEveryExceptionMask, I can
    intercept all exceptions, but that includes exceptions that are
    specifically handled in my code, so that is not what I want.

    But if I set the mask to anything less (eg
    NSHandleUncaughtExceptionMask|NSHandleUncaughtSystemExceptionMask|
    NSHandleUncaughtRuntimeErrorMask|NSHandleTopLevelExceptionMask) many
    exceptions never reach me, they just are logged with something like

    Exception raised during posting of notification.  Ignored.
    exception: (my exception here)

    How can I get Cocoa to NOT ignore those exceptions so that they reach
    the top-level handler?

    Thanks

    Gerd
  • On Wed, 17 Oct 2007 11:14:13 -0500, Gerd Knops <gerti-cocoadev...>
    said:
    > I am trying to add an exception handling to my application that
    > catches uncaught exceptions.
    >
    > Problem is there seems to be exception handling within cocoa 'under'
    > the top level, that causes exceptions to be ignored.
    >
    > If I add a delegate to the defaultExceptionHandler and
    > setExceptionHandlingMask:NSLogAndHandleEveryExceptionMask, I can
    > intercept all exceptions, but that includes exceptions that are
    > specifically handled in my code, so that is not what I want.
    >
    > But if I set the mask to anything less (eg
    > NSHandleUncaughtExceptionMask|NSHandleUncaughtSystemExceptionMask|
    > NSHandleUncaughtRuntimeErrorMask|NSHandleTopLevelExceptionMask) many
    > exceptions never reach me, they just are logged with something like
    >
    > Exception raised during posting of notification.  Ignored.
    > exception: (my exception here)
    >
    > How can I get Cocoa to NOT ignore those exceptions so that they reach
    > the top-level handler?

    http://www.cocoabuilder.com/archive/message/cocoa/2004/2/10/96562

    m.
    --
    matt neuburg, phd = <matt...>, <http://www.tidbits.com/matt/>
    A fool + a tool + an autorelease pool = cool!
    One of the 2007 MacTech Top 25: <http://tinyurl.com/2rh4pf>
    AppleScript: the Definitive Guide - Second Edition!
    <http://www.amazon.com/gp/product/0596102119>
  • On Oct 17, 2007, at 6:30 PM, Matt Neuburg wrote:

    This catches all exceptions, even those properly handled by my code.
    So no help here.

    Gerd
  • >> http://www.cocoabuilder.com/archive/message/cocoa/2004/2/10/96562
    >
    > This catches all exceptions, even those properly handled by my
    > code. So no help here.

    Unfortunately that's all you can do at this point. There's no way to
    distinguish between exceptions that will be caught by a local
    exception handler and those that will be silently intercepted by
    AppKit. More discussion:

    http://www.cocoabuilder.com/archive/message/cocoa/2004/8/11/114250

    ~Martin
  • On Oct 17, 2007, at 9:10 PM, Martin Wierschin wrote:

    >>> http://www.cocoabuilder.com/archive/message/cocoa/2004/2/10/96562
    >>
    >> This catches all exceptions, even those properly handled by my
    >> code. So no help here.
    >
    > Unfortunately that's all you can do at this point. There's no way
    > to distinguish between exceptions that will be caught by a local
    > exception handler and those that will be silently intercepted by
    > AppKit. More discussion:
    >
    > http://www.cocoabuilder.com/archive/message/cocoa/2004/8/11/114250

    Thanks. I searched quite a bit, but did not come across that specific
    thread which confirms my observations. To bad that after 3 years they
    still have not cleaned up this mess. It makes exception handling
    useless for anything but localized use...

    Thanks again

    Gerd
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today