Skip to content

Instantly share code, notes, and snippets.

@pita5
Created August 15, 2012 11:52
Show Gist options
  • Save pita5/3359471 to your computer and use it in GitHub Desktop.
Save pita5/3359471 to your computer and use it in GitHub Desktop.
- (void)_failWithConnectionError:(void(^)(NSError *error, NSDictionary *responseInfo))completion
caller:(dispatch_queue_t)caller
{
NSParameterAssert(completion);
if (dispatch_get_current_queue() == caller)
{
completion([NSError errorWithDomain:ERROR_DOMAIN
code:kConnectionError
userInfo:nil], nil);
}
else
{
dispatch_async(caller, ^{
completion([NSError errorWithDomain:ERROR_DOMAIN
code:kConnectionError
userInfo:nil], nil);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment