Skip to content

Commit

Permalink
Merge pull request #1 from transferwise/feature/remove-crash-handler
Browse files Browse the repository at this point in the history
Remove crash handler registration
  • Loading branch information
jwelton authored Apr 29, 2024
2 parents 2dce684 + 4b5cbdf commit fa2572a
Showing 1 changed file with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,25 +125,29 @@ static void handleUncaughtException(NSException* exception) {

static void setEnabled(bool isEnabled)
{
if(isEnabled != g_isEnabled)
{
g_isEnabled = isEnabled;
if(isEnabled)
{
RCLOG_DEBUG(@"Backing up original handler.");
g_previousUncaughtExceptionHandler = NSGetUncaughtExceptionHandler();

RCLOG_DEBUG(@"Setting new handler.");
NSSetUncaughtExceptionHandler(&handleUncaughtException);
RollbarCrashHandler.sharedInstance.uncaughtExceptionHandler = &handleUncaughtException;
RollbarCrashHandler.sharedInstance.currentSnapshotUserReportedExceptionHandler = &handleCurrentSnapshotUserReportedException;
}
else
{
RCLOG_DEBUG(@"Restoring original handler.");
NSSetUncaughtExceptionHandler(g_previousUncaughtExceptionHandler);
}
}
// Wise: Wise has tooling already in place for crash reports, so we don't want to set a crash handler when
// setting up Rollbar. Currently there's no option to disable this from the public API of the Rollbar SDK.
// Rollbar have placed this into their feature backlog, which we should adopt once available.
//
// if(isEnabled != g_isEnabled)
// {
// g_isEnabled = isEnabled;
// if(isEnabled)
// {
// RCLOG_DEBUG(@"Backing up original handler.");
// g_previousUncaughtExceptionHandler = NSGetUncaughtExceptionHandler();
//
// RCLOG_DEBUG(@"Setting new handler.");
// NSSetUncaughtExceptionHandler(&handleUncaughtException);
// RollbarCrashHandler.sharedInstance.uncaughtExceptionHandler = &handleUncaughtException;
// RollbarCrashHandler.sharedInstance.currentSnapshotUserReportedExceptionHandler = &handleCurrentSnapshotUserReportedException;
// }
// else
// {
// RCLOG_DEBUG(@"Restoring original handler.");
// NSSetUncaughtExceptionHandler(g_previousUncaughtExceptionHandler);
// }
// }
}

static bool isEnabled(void)
Expand Down

0 comments on commit fa2572a

Please sign in to comment.