exception auditing OWSRaiseException

pull/1/head
Michael Kirk 6 years ago
parent 3a6aafc454
commit 9d2731c9b8

@ -40,7 +40,8 @@ NS_ASSUME_NONNULL_BEGIN
+ (NSString *)migrationId
{
OWSRaiseException(NSInternalInconsistencyException, @"Must override %@ in subclass", NSStringFromSelector(_cmd));
OWSAbstractMethod();
return @"";
}
+ (NSString *)collection
@ -51,7 +52,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)runUpWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
{
OWSRaiseException(NSInternalInconsistencyException, @"Must override %@ in subclass", NSStringFromSelector(_cmd));
OWSAbstractMethod();
}
- (void)runUpWithCompletion:(OWSDatabaseMigrationCompletion)completion

@ -159,7 +159,7 @@ NSString *const TSAccountManager_NeedsAccountAttributesUpdateKey = @"TSAccountMa
NSString *phoneNumber = self.phoneNumberAwaitingVerification;
if (!phoneNumber) {
OWSRaiseException(@"RegistrationFail", @"Internal Corrupted State");
OWSFail(@"phonNumber was unexpectedly nil");
}
[self storeLocalNumber:phoneNumber];

@ -213,8 +213,7 @@ NS_ASSUME_NONNULL_BEGIN
// We need to use an Intel certificate as the anchor for IAS verification.
NSData *_Nullable anchorCertificate = [self certificateDataForService:@"ias-root"];
if (!anchorCertificate) {
OWSFailDebug(@"could not load anchor certificate.");
OWSRaiseException(@"OWSSignalService_CouldNotLoadCertificate", @"%s", __PRETTY_FUNCTION__);
OWSFail(@"could not load anchor certificate.");
} else {
anchorCertificates = @[ anchorCertificate ];
}

@ -839,7 +839,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
NSArray<NSDictionary *> *deviceMessages;
@try {
deviceMessages = [self deviceMessagesForMessageSendUnsafe:messageSend];
deviceMessages = [self try_deviceMessagesForMessageSendUnsafe:messageSend];
} @catch (NSException *exception) {
if ([exception.name isEqualToString:UntrustedIdentityKeyException]) {
// This *can* happen under normal usage, but it should happen relatively rarely.
@ -1407,8 +1407,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
[self sendMessageToRecipient:messageSend];
}
// NOTE: This method uses exceptions for control flow.
- (NSArray<NSDictionary *> *)deviceMessagesForMessageSendUnsafe:(OWSMessageSend *)messageSend
- (NSArray<NSDictionary *> *)try_deviceMessagesForMessageSendUnsafe:(OWSMessageSend *)messageSend
{
OWSAssertDebug(messageSend.message);
OWSAssertDebug(messageSend.recipient);
@ -1444,7 +1443,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
@try {
// This may involve blocking network requests, so we do it _before_
// we open a transaction.
[self ensureRecipientHasSessionForMessageSend:messageSend deviceId:deviceId];
[self try_ensureRecipientHasSessionForMessageSend:messageSend deviceId:deviceId];
__block NSDictionary *messageDict;
__block NSException *encryptionException;
@ -1486,9 +1485,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
return [messagesArray copy];
}
// NOTE: This method uses exceptions for control flow.
- (void)ensureRecipientHasSessionForMessageSend:(OWSMessageSend *)messageSend
deviceId:(NSNumber *)deviceId
- (void)try_ensureRecipientHasSessionForMessageSend:(OWSMessageSend *)messageSend deviceId:(NSNumber *)deviceId
{
OWSAssertDebug(messageSend);
OWSAssertDebug(deviceId);

Loading…
Cancel
Save