HomePhabricator
Diffusion Comm aa2f2bd74443

Correct error handling across Objective-C and C++

Description

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:

  1. Put throw std:runtime_error("..."); just above [self decryptBestAttemptContent];
  2. 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).

  1. Put @throw [NSException exceptionWithName:@"dummy" reason:nil userInfo:nil]; just above [self decryptBestAttemptContent];
  2. 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

Details

Provenance
marcinAuthored on Aug 22 2023, 3:36 AM
Reviewer
tomek
Differential Revision
D8906: Correct error handling across Objective-C and C++
Parents
rCOMM70cf45852540: Introduce thread-safety to NotificationsCryptoModule during cuncurrent access
Branches
Unknown
Tags
Unknown