ftp.nice.ch/Attic/openStep/developer/resources/CrashTrap.1.6.mw.s.tgz#/CrashTrap/App.m

This is App.m in view mode; [Download] [Up]

static const char *rcsid = "$Id$ cc: "__DATE__" "__TIME__;

// Suppress compiler warning about rcsid being unused, yet prevent assembler
// code for this function from being produced.
inline extern const char *suppressCompilerWarning(void)
{
    return rcsid;
}

//
// ------------------------ App Class Implementation --------------------------
//
// NSApplication subclass that catches exceptions.
//
// AUTHOR: Art Isbell
// ----------------------------------------------------------------------------
//

// ----------------------------- Header Files ---------------------------------

#import <AppKit/AppKit.h>

#import "App.h"
#import "OEObject.h"

// ---------------- Typedef, Struct, and Union Declarations -------------------

// --------------------- Constant and Enum Definitions ------------------------

// ------------------------- Function Declarations ----------------------------

/*
@interface App(Private)
// ---------------------- Private Method Declarations -------------------------

@end
*/
@implementation App
// ----------------------- Class Method Definitions ---------------------------

// ---------------- Overridden Instance Method Definitions --------------------

// -------------------- New Instance Method Definitions -----------------------

// Overriding reportException: seems like what must be done under OS to replace
// the functionality of the NS NXSetTopLevelErrorHandler().
- (void)reportException:(NSException *)theException
{
    [super reportException:theException];

    if ([[theException name] isEqualToString:[OEObject crashException]] &&
        (NSRunCriticalAlertPanel(nil, NSLocalizedString(@"An internal error has occurred.  Try to save any unsaved changes.  Continuing may result in repeated errors.  If so, quit and restart %@.", Alert panel text displayed when a normally-fatal error has occurred.  %@ is the application name.),
                                 @"Continue", @"Quit", nil, [[NSProcessInfo
                                     processInfo] processName]) !=
         NSAlertDefaultReturn))
    {
        [self terminate:nil];
    }
}

// ----------------- Delegate Instance Method Definitions ---------------------

@end
/*
@implementation App(Private)
// ---------------------- Private Method Definitions --------------------------

@end
*/
// ------------------------- Function Definitions -----------------------------

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.