Include reusable localized text in recipient-not-found error

This way we can use it for calls as well.

// FREEBIE
pull/1/head
Michael Kirk 9 years ago
parent 7ca1d5e8a6
commit 7b1b706e2a

@ -10,8 +10,6 @@ NS_ASSUME_NONNULL_BEGIN
@interface ContactsUpdater : NSObject
#define NOTFOUND_ERROR 777404
+ (instancetype)sharedUpdater;
- (nullable SignalRecipient *)synchronousLookup:(NSString *)identifier error:(NSError **)error;

@ -66,9 +66,7 @@ NS_ASSUME_NONNULL_BEGIN
if (matchedIds.count == 1) {
success([SignalRecipient recipientWithTextSecureIdentifier:identifier]);
} else {
failure([NSError errorWithDomain:@"contactsmanager.notfound"
code:NOTFOUND_ERROR
userInfo:nil]);
failure(OWSErrorMakeNoSuchSignalRecipientError());
}
}
failure:failure];

@ -286,13 +286,12 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
recipient = [self.contactsUpdater synchronousLookup:recipientContactId error:&error];
if (error) {
if (error.code == NOTFOUND_ERROR) {
DDLogWarn(@"recipient contact not found with error: %@", error);
if (error.code == OWSErrorCodeNoSuchSignalRecipient) {
DDLogWarn(@"%@ recipient contact not found", self.tag);
[self unregisteredRecipient:recipient message:message thread:thread];
NSError *error = OWSErrorMakeNoSuchSignalRecipientError();
return failureHandler(error);
}
DDLogError(@"contact lookup failed with error: %@", error);
DDLogError(@"%@ contact lookup failed with error: %@", self.tag, error);
return failureHandler(error);
}
}

@ -20,6 +20,7 @@ typedef NS_ENUM(NSInteger, OWSErrorCode) {
OWSErrorCodeSignalServiceFailure = 1001,
OWSErrorCodeSignalServiceRateLimited = 1010,
OWSErrorCodeUserError = 2001,
OWSErrorCodeNoSuchSignalRecipient = 777404,
};
extern NSError *OWSErrorWithCodeDescription(OWSErrorCode code, NSString *description);

Loading…
Cancel
Save