Changeset 1515

Show
Ignore:
Timestamp:
08/21/04 13:45:31 (4 years ago)
Author:
morris
Message:

add exception handling

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredClient/trunk/English.lproj/MainMenu.nib/classes.nib

    r1382 r1515  
    6565                "_deleteMenuItem" = NSMenuItem;  
    6666                "_disconnectMenuItem" = NSMenuItem;  
     67                "_exceptionPanel" = NSPanel;  
     68                "_exceptionTextView" = NSTextView;  
    6769                "_filesMenu" = NSMenu;  
    6870                "_filesMenuItem" = NSMenuItem;  
  • WiredClient/trunk/English.lproj/MainMenu.nib/info.nib

    r1382 r1515  
    44<dict> 
    55        <key>IBDocumentLocation</key> 
    6         <string>789 372 412 357 0 0 1280 1002 </string> 
     6        <string>395 406 412 357 0 0 1280 1002 </string> 
    77        <key>IBEditorPositions</key> 
    88        <dict> 
     
    1818        <key>IBOpenObjects</key> 
    1919        <array> 
     20                <integer>701</integer> 
    2021                <integer>29</integer> 
    2122        </array> 
    2223        <key>IBSystem Version</key> 
    23         <string>7H63</string> 
     24        <string>7M34</string> 
    2425</dict> 
    2526</plist> 
  • WiredClient/trunk/WCMain.h

    r1383 r1515  
    1 /* $Id: WCMain.h,v 1.10 2004/07/28 08:00:26 morris Exp $ */ 
     1/* $Id: WCMain.h,v 1.11 2004/08/21 11:45:08 morris Exp $ */ 
    22 
    33/* 
     
    7373        IBOutlet NSProgressIndicator    *_progressIndicator; 
    7474         
     75        IBOutlet NSPanel                                *_exceptionPanel; 
     76        IBOutlet NSTextView                             *_exceptionTextView; 
     77         
    7578        unsigned int                                    _connections; 
    7679        WCConnection                                    *_connection; 
  • WiredClient/trunk/WCMain.m

    r1505 r1515  
    1 /* $Id: WCMain.m,v 1.39 2004/08/16 17:38:18 morris Exp $ */ 
     1/* $Id: WCMain.m,v 1.40 2004/08/21 11:45:08 morris Exp $ */ 
    22 
    33/* 
     
    9696                kCFCoreFoundationVersionNumber, 
    9797                NSAppKitVersionNumber]; 
     98         
     99        // --- set exception handler 
     100        [[NSExceptionHandler defaultExceptionHandler] setExceptionHandlingMask:NSLogAndHandleEveryExceptionMask]; 
     101        [[NSExceptionHandler defaultExceptionHandler] setDelegate:self]; 
    98102 
    99103        // --- subscribe to these 
     
    274278                postNotificationName:WCApplicationDidChangeStatus 
    275279                object:NULL]; 
     280} 
     281 
     282 
     283 
     284- (BOOL)exceptionHandler:(NSExceptionHandler *)exceptionHandler shouldLogException:(NSException *)exception mask:(unsigned int)mask { 
     285        NSString        *trace, *command; 
     286        FILE            *fp; 
     287        char            buffer[BUFSIZ]; 
     288        int                     n; 
     289         
     290        trace = [[exception userInfo] objectForKey:NSStackTraceKey]; 
     291         
     292        if(trace) { 
     293                command = [NSString stringWithFormat:@"/usr/bin/atos -p %d %@ | cat -n", 
     294                        getpid(), trace]; 
     295                fp = popen([command UTF8String], "r"); 
     296                 
     297                if(fp) { 
     298                        [_exceptionTextView setFont:[NSFont fontWithName:@"Monaco" size:9.0]]; 
     299                        [_exceptionTextView setString:[NSString stringWithFormat: 
     300                                @"%@: %@\n\nStack trace:\n", 
     301                                [exception name], 
     302                                [exception reason]]]; 
     303                         
     304                        while((n = fread(buffer, 1, sizeof(buffer), fp))) { 
     305                                [[[_exceptionTextView textStorage] mutableString] 
     306                                        appendString:[NSString stringWithCString:buffer length:n]]; 
     307                        } 
     308                         
     309                        [_exceptionPanel center]; 
     310                        [_exceptionPanel makeKeyAndOrderFront:self]; 
     311                         
     312                        pclose(fp); 
     313                } 
     314        } 
     315         
     316        return YES; 
    276317} 
    277318 
     
    699740- (IBAction)connect:(id)sender { 
    700741        [self showConnect:NULL]; 
     742 
     743        NSArray *array = [NSArray array]; 
     744        [array objectAtIndex:5]; 
    701745} 
    702746 
  • WiredClient/trunk/WiredClient.xcode/project.pbxproj

    r1497 r1515  
    1010                                1058C7A1FEA54F0111CA2CBB, 
    1111                                A509AD1105F7FBFF00E6AE2D, 
     12                                A5D4F27F06D75DA4002A33D0, 
    1213                        ); 
    1314                        isa = PBXGroup; 
     
    571572                                8D11072F0486CEB800E47090, 
    572573                                A509AD1205F7FBFF00E6AE2D, 
     574                                A5D4F28006D75DA4002A33D0, 
    573575                        ); 
    574576                        isa = PBXFrameworksBuildPhase; 
     
    19171919                        targetProxy = A5D4EF0006CD3A58002A33D0; 
    19181920                }; 
     1921                A5D4F27F06D75DA4002A33D0 = { 
     1922                        isa = PBXFileReference; 
     1923                        lastKnownFileType = wrapper.framework; 
     1924                        name = ExceptionHandling.framework; 
     1925                        path = /System/Library/Frameworks/ExceptionHandling.framework; 
     1926                        refType = 0; 
     1927                        sourceTree = "<absolute>"; 
     1928                }; 
     1929                A5D4F28006D75DA4002A33D0 = { 
     1930                        fileRef = A5D4F27F06D75DA4002A33D0; 
     1931                        isa = PBXBuildFile; 
     1932                        settings = { 
     1933                        }; 
     1934                }; 
    19191935                A5DC7E2A057AA99B00736BBF = { 
    19201936                        buildActionMask = 2147483647; 
  • WiredClient/trunk/prefix.pch

    r1206 r1515  
    1 /* $Id: prefix.pch,v 1.3 2004/05/17 16:46:32 morris Exp $ */ 
     1/* $Id: prefix.pch,v 1.4 2004/08/21 11:45:08 morris Exp $ */ 
    22 
    33/* 
     
    3131#import <Carbon/Carbon.h> 
    3232#import <Cocoa/Cocoa.h> 
     33#import <ExceptionHandling/NSExceptionHandler.h> 
    3334 
    3435#import <sys/types.h> 
     
    4849#import <openssl/ssl.h> 
    4950 
    50 #define                NSStrikethroughStyleAttributeName              @"NSStrikethrough" 
    51 #define                NSCursorAttributeName                                  @"NSCursor" 
     51#define NSStrikethroughStyleAttributeName             @"NSStrikethrough" 
     52#define NSCursorAttributeName                                 @"NSCursor"