Fix network manager error wrapping.

This commit is contained in:
Matthew Chen 2018-10-29 12:59:16 -04:00
parent 6e386b75c4
commit a5f715eca1
2 changed files with 8 additions and 5 deletions

View File

@ -1673,6 +1673,9 @@
/* No comment provided by engineer. */
"REGISTER_RATE_LIMITING_BODY" = "You have tried too often. Please wait a minute before trying again.";
/* No comment provided by engineer. */
"REGISTER_RATE_LIMITING_ERROR" = "You have tried too often. Please wait a minute before trying again.";
/* Title of alert shown when push tokens sync job fails. */
"REGISTRATION_BODY" = "Failed to re-register for push notifications.";

View File

@ -263,19 +263,19 @@ typedef void (^failureBlock)(NSURLSessionDataTask *task, NSError *error);
recoverySuggestion:NSLocalizedString(@"MULTIDEVICE_PAIRING_MAX_RECOVERY",
@"alert body: cannot link - reached max linked devices")
fallbackError:networkError];
error.isRetryable = NO;
failureBlock(task, error);
customError.isRetryable = NO;
failureBlock(task, customError);
break;
}
case 413: {
OWSLogWarn(@"Rate limit exceeded: %@", request);
NSError *customError = [self errorWithHTTPCode:statusCode
description:NSLocalizedString(@"REGISTRATION_ERROR", nil)
description:NSLocalizedString(@"REGISTER_RATE_LIMITING_ERROR", nil)
failureReason:networkError.localizedFailureReason
recoverySuggestion:NSLocalizedString(@"REGISTER_RATE_LIMITING_BODY", nil)
fallbackError:networkError];
error.isRetryable = NO;
failureBlock(task, error);
customError.isRetryable = NO;
failureBlock(task, customError);
break;
}
case 417: {