* Added MYReturnError.
* Better iPhone support in ExceptionUtils.
* Make sure "All Tests Passed/Failed" message is always logged.
5 // Created by Jens Alfke on 1/5/08.
6 // Copyright 2008 Jens Alfke. All rights reserved.
7 // See BSD license at bottom of ExceptionUtils.m.
10 #import <Foundation/Foundation.h>
13 #ifdef NSAppKitVersionNumber10_4 // only enable this in a project that uses AppKit
14 /** Edit your Info.plist to make this your app's principal class,
15 and most exceptions will be reported via a modal alert.
16 This includes exceptions caught by AppKit (i.e. uncaught ones from event handlers)
17 and ones you report yourself via MYReportException and @catchAndReport. */
18 @interface MYExceptionReportingApplication : NSApplication
23 /** A useful macro to use in code where you absolutely cannot allow an exception to
24 go uncaught because it would crash (e.g. in a C callback or at the top level of a thread.)
25 It catches the exception but makes sure it gets reported. */
26 #define catchAndReport(MSG...) @catch(NSException *x) {MYReportException(x,MSG);}
29 /** Report an exception that's being caught and consumed.
30 Logs a warning to the console, and calls the current MYReportException target if any. */
31 void MYReportException( NSException *x, NSString *where, ... );
34 /** Sets a callback to be invoked when MYReportException is called.
35 In a GUI app, the callback would typically call [NSApp reportException: theException].
36 The ExceptionReportingApplication class, below, sets this up automatically. */
37 void MYSetExceptionReporter( void (*reporter)(NSException*) );
40 @interface NSException (MYUtilities)
41 /** Returns a textual, human-readable backtrace of the point where the exception was thrown. */
42 - (NSString*) my_callStack;
46 BOOL IsGDBAttached( void );