1
1
#import " ZPCQueryManager.h"
2
+ #import " ZPCErrors.h"
2
3
#import " ZPCLog.h"
3
4
4
5
typedef void (^ResponseBlock)(id response, NSError *error);
@@ -17,7 +18,6 @@ @implementation ZPCQueryManager
17
18
static NSString *const PlayerQuery = @" player" ;
18
19
19
20
static NSString *const ZPCErrorDomain = @" com.Zapic" ;
20
- static NSInteger const ZPCErrorUnavailable = 2600 ;
21
21
22
22
- (void )setIsReady : (BOOL )isReady {
23
23
if (isReady == _isReady) {
@@ -69,10 +69,10 @@ - (void)handleResponse:(NSDictionary *)data {
69
69
// If this is an error response, trigger the callback right away
70
70
if (error) {
71
71
NSString *msg = payload[@" errorMessage" ];
72
- id codeObj = payload[@" code " ];
72
+ id codeObj = payload[@" errorCode " ];
73
73
NSError *error;
74
74
if (codeObj == nil ) {
75
- error = [NSError errorWithDomain: ZPCErrorDomain code: ZPCErrorUnavailable userInfo: @{@" errorMsg" : @" Unknown error" }];
75
+ error = [NSError errorWithDomain: ZPCErrorDomain code: ZPCFailedToStartError userInfo: @{@" errorMsg" : @" Unknown error" }];
76
76
} else {
77
77
error = [NSError errorWithDomain: ZPCErrorDomain code: [codeObj intValue ] userInfo: @{@" errorMsg" : msg}];
78
78
}
@@ -102,7 +102,7 @@ - (void)sendQuery:(NSString *)dataType withCompletionHandler:(ResponseBlock)comp
102
102
// If requests cant be processed now, cancel immediately
103
103
if (!_isReady) {
104
104
NSError *error = [NSError errorWithDomain: ZPCErrorDomain
105
- code: ZPCErrorUnavailable
105
+ code: ZPCFailedToStartError
106
106
userInfo: nil ];
107
107
108
108
completionHandler (nil , error);
@@ -129,7 +129,7 @@ - (void)sendQuery:(NSString *)dataType withCompletionHandler:(ResponseBlock)comp
129
129
- (void )failAllQueries {
130
130
for (NSString *requestId in _requests) {
131
131
NSError *error = [NSError errorWithDomain: ZPCErrorDomain
132
- code: ZPCErrorUnavailable
132
+ code: ZPCFailedToStartError
133
133
userInfo: nil ];
134
134
135
135
// Gets the handler
0 commit comments