diff --git a/Providers/Facebook/SimpleAuthFacebookProvider.m b/Providers/Facebook/SimpleAuthFacebookProvider.m index b41a02c..224731d 100644 --- a/Providers/Facebook/SimpleAuthFacebookProvider.m +++ b/Providers/Facebook/SimpleAuthFacebookProvider.m @@ -83,11 +83,22 @@ - (RACSignal *)remoteAccountWithSystemAccount:(ACAccount *)account { [subscriber sendCompleted]; } else { - [subscriber sendError:parseError]; + NSMutableDictionary *dictionary = [NSMutableDictionary new]; + if (parseError) { + dictionary[NSUnderlyingErrorKey] = parseError; + } + NSError *error = [NSError errorWithDomain:SimpleAuthErrorDomain code:SimpleAuthErrorInvalidData userInfo:dictionary]; + [subscriber sendNext:error]; } } else { - [subscriber sendError:connectionError]; + NSMutableDictionary *dictionary = [NSMutableDictionary new]; + if (connectionError) { + dictionary[NSUnderlyingErrorKey] = connectionError; + } + dictionary[SimpleAuthErrorStatusCodeKey] = @(statusCode); + NSError *error = [NSError errorWithDomain:SimpleAuthErrorDomain code:SimpleAuthErrorNetwork userInfo:dictionary]; + [subscriber sendError:error]; } }]; return nil; diff --git a/Providers/Twitter/SimpleAuthTwitterProvider.m b/Providers/Twitter/SimpleAuthTwitterProvider.m index 485a2aa..3898ed2 100644 --- a/Providers/Twitter/SimpleAuthTwitterProvider.m +++ b/Providers/Twitter/SimpleAuthTwitterProvider.m @@ -357,11 +357,22 @@ - (RACSignal *)accountWithAccessToken:(NSDictionary *)accessToken { [subscriber sendCompleted]; } else { - [subscriber sendError:parseError]; + NSMutableDictionary *dictionary = [NSMutableDictionary new]; + if (parseError) { + dictionary[NSUnderlyingErrorKey] = parseError; + } + NSError *error = [NSError errorWithDomain:SimpleAuthErrorDomain code:SimpleAuthErrorInvalidData userInfo:dictionary]; + [subscriber sendNext:error]; } } else { - [subscriber sendError:connectionError]; + NSMutableDictionary *dictionary = [NSMutableDictionary new]; + if (connectionError) { + dictionary[NSUnderlyingErrorKey] = connectionError; + } + dictionary[SimpleAuthErrorStatusCodeKey] = @(statusCode); + NSError *error = [NSError errorWithDomain:SimpleAuthErrorDomain code:SimpleAuthErrorNetwork userInfo:dictionary]; + [subscriber sendError:error]; } }]; return nil;