@@ -134,7 +134,13 @@ - (RACSignal *)reverseAuthRequestToken {
134134 [subscriber sendCompleted ];
135135 }
136136 else {
137- [subscriber sendError: connectionError];
137+ NSMutableDictionary *dictionary = [NSMutableDictionary new ];
138+ if (connectionError) {
139+ dictionary[NSUnderlyingErrorKey ] = connectionError;
140+ }
141+ dictionary[SimpleAuthErrorStatusCodeKey] = @(statusCode);
142+ NSError *error = [NSError errorWithDomain: SimpleAuthErrorDomain code: SimpleAuthErrorNetwork userInfo: dictionary];
143+ [subscriber sendError: error];
138144 }
139145 }];
140146 return nil ;
@@ -165,11 +171,22 @@ - (RACSignal *)remoteAccountWithSystemAccount:(ACAccount *)account {
165171 [subscriber sendCompleted ];
166172 }
167173 else {
168- [subscriber sendNext: parseError];
174+ NSMutableDictionary *dictionary = [NSMutableDictionary new ];
175+ if (parseError) {
176+ dictionary[NSUnderlyingErrorKey ] = parseError;
177+ }
178+ NSError *error = [NSError errorWithDomain: SimpleAuthErrorDomain code: SimpleAuthErrorInvalidData userInfo: dictionary];
179+ [subscriber sendNext: error];
169180 }
170181 }
171182 else {
172- [subscriber sendError: connectionError];
183+ NSMutableDictionary *dictionary = [NSMutableDictionary new ];
184+ if (connectionError) {
185+ dictionary[NSUnderlyingErrorKey ] = connectionError;
186+ }
187+ dictionary[SimpleAuthErrorStatusCodeKey] = @(statusCode);
188+ NSError *error = [NSError errorWithDomain: SimpleAuthErrorDomain code: SimpleAuthErrorNetwork userInfo: dictionary];
189+ [subscriber sendError: error];
173190 }
174191 }];
175192 return nil ;
@@ -196,7 +213,13 @@ - (RACSignal *)accessTokenWithReverseAuthRequestToken:(NSString *)token account:
196213 [subscriber sendCompleted ];
197214 }
198215 else {
199- [subscriber sendError: connectionError];
216+ NSMutableDictionary *dictionary = [NSMutableDictionary new ];
217+ if (connectionError) {
218+ dictionary[NSUnderlyingErrorKey ] = connectionError;
219+ }
220+ dictionary[SimpleAuthErrorStatusCodeKey] = @(statusCode);
221+ NSError *error = [NSError errorWithDomain: SimpleAuthErrorDomain code: SimpleAuthErrorNetwork userInfo: dictionary];
222+ [subscriber sendError: error];
200223 }
201224 }];
202225 return nil ;
0 commit comments