add category prefix to stripeerror

This commit is contained in:
Jack Flintermann 2015-10-15 17:14:25 -04:00
parent 858a9e25cc
commit 39e0759842
3 changed files with 3 additions and 3 deletions

View File

@ -66,6 +66,6 @@ FOUNDATION_EXPORT NSString * __nonnull const STPIncorrectCVC;
@interface NSError(Stripe)
+ (nullable NSError *)errorFromStripeResponse:(nullable NSDictionary *)jsonDictionary;
+ (nullable NSError *)stp_errorFromStripeResponse:(nullable NSDictionary *)jsonDictionary;
@end

View File

@ -27,7 +27,7 @@
[[apiClient.urlSession dataTaskWithRequest:request completionHandler:^(NSData * _Nullable body, __unused NSURLResponse * _Nullable response, NSError * _Nullable error) {
NSDictionary *jsonDictionary = body ? [NSJSONSerialization JSONObjectWithData:body options:0 error:NULL] : nil;
id<STPAPIResponseDecodable> responseObject = [[serializer class] decodedObjectFromAPIResponse:jsonDictionary];
NSError *returnedError = [NSError errorFromStripeResponse:jsonDictionary] ?: error;
NSError *returnedError = [NSError stp_errorFromStripeResponse:jsonDictionary] ?: error;
if (!responseObject && !returnedError) {
NSDictionary *userInfo = @{
NSLocalizedDescriptionKey: STPUnexpectedError,

View File

@ -25,7 +25,7 @@ NSString *const STPIncorrectCVC = @"com.stripe.lib:IncorrectCVC";
@implementation NSError(Stripe)
+ (NSError *)errorFromStripeResponse:(NSDictionary *)jsonDictionary {
+ (NSError *)stp_errorFromStripeResponse:(NSDictionary *)jsonDictionary {
NSDictionary *errorDictionary = jsonDictionary[@"error"];
if (!errorDictionary) {
return nil;