Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Give a nicer error message for authentication errors

  • Loading branch information...
commit a41fb2ae1322b4a9221728b013acb6ca727c98ab 1 parent 6fe2696
Brent Royal-Gordon authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 ANRequest.m
View
8 ANRequest.m
@@ -163,6 +163,14 @@ - (void)sendRequestWithDataCompletion:(void (^)(NSData * body, NSError * error))
}
}
+ if(error.code == NSURLErrorUserCancelledAuthentication && [error.domain isEqualToString:NSURLErrorDomain]) {
+ NSMutableDictionary * userInfo = error.userInfo.mutableCopy;
+ [userInfo setObject:NSLocalizedString(@"Your account is not allowed to perform this operation.", @"") forKey:NSLocalizedDescriptionKey];
+ [userInfo setObject:error forKey:NSUnderlyingErrorKey];
+
+ error = [NSError errorWithDomain:error.domain code:error.code userInfo:userInfo.copy];
+ }
+
if(error) {
completion(body, error);
return;
Please sign in to comment.
Something went wrong with that request. Please try again.