forked from microsoft/appcenter-sdk-apple
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a button on test app to raise an exception from NSApplication.
- Loading branch information
1 parent
a033117
commit 2484b5f
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#import "MSCrash.h" | ||
|
||
@interface MSCrashNSApp : MSCrash | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#import "MSCrashNSApp.h" | ||
|
||
@implementation MSCrashNSApp | ||
|
||
- (NSString *)category { | ||
return @"Exceptions"; | ||
} | ||
|
||
- (NSString *)title { | ||
return @"Throw Objective-C exception avoiding send event"; | ||
} | ||
|
||
- (NSString *)desc { | ||
return @"" | ||
"Throw an uncaught Objective-C exception avoiding send event. " | ||
"It's possible to generate a better crash report here compared to the C++ Exception case " | ||
"because NSUncaughtExceptionHandler can be used, which isn't available for C++ extensions."; | ||
} | ||
|
||
- (void)crash { | ||
[self performSelector:@selector(delayedException) withObject:nil afterDelay:0.1]; | ||
} | ||
|
||
- (void)delayedException { | ||
@throw [NSException exceptionWithName:NSGenericException reason:@"An uncaught exception! SCREAM." | ||
userInfo:@{NSLocalizedDescriptionKey: @"I'm in your program, catching your exceptions!"}]; | ||
} | ||
|
||
@end |