Permalink
Browse files

Handle exceeding rate limit.

Connection returns NSError with UAGithubAPILimitReached domain.
  • Loading branch information...
1 parent d851751 commit 535d9f59875476f13b3b880df47084a459537095 Owain R Hunt committed Dec 19, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 UAGithubEngine.m
View
3 UAGithubEngine.m
@@ -245,6 +245,9 @@ - (id)sendRequest:(NSString *)path requestType:(UAGithubRequestType)requestType
if ([[[resp allHeaderFields] allKeys] containsObject:@"X-Ratelimit-Remaining"] && [[[resp allHeaderFields] valueForKey:@"X-Ratelimit-Remaining"] isEqualToString:@"1"])
+ {
+ return [NSError errorWithDomain:UAGithubAPILimitReached code:statusCode userInfo:[NSDictionary dictionaryWithObject:urlRequest forKey:@"request"]];
+ }
if (statusCode >= 400)
{

0 comments on commit 535d9f5

Please sign in to comment.