Correct error handling across Objective-C and C++
Summary:
This differential fixes invalid error handling in NSE code. Pure Objective-C @try{}...@catch{} statement cannot handle C++ std::exception. This differential solves this issue. Additionally StaffUtils::isStaffRelease functionality is used to
decide whether silence notification during error or display error message to the user in a notification.
Test Plan:
- Put throw std:runtime_error("..."); just above [self decryptBestAttemptContent];
- Send Notification.
Before applying this diff nothing will be seen in NSE console. After applying this diff appropriate error message will be logged to the console and error notification displayed (assuming you changed StaffUtils::isStaffRelease to return true).
- Put @throw [NSException exceptionWithName:@"dummy" reason:nil userInfo:nil]; just above [self decryptBestAttemptContent];
- Send notification
Before applying this diff error will be logged to the console and notification silenced. After applying this diff appropriate error message will be logged to the console and error notification displayed (assuming you changed StaffUtils::isStaffRelease to return true).
Reviewers: tomek, bartek, ashoat
Reviewed By: tomek, ashoat
Differential Revision: https://phab.comm.dev/D8906