@@ -61,21 +61,25 @@ - (void)_taskDidFinish {
61
61
return ;
62
62
}
63
63
64
- if ([result isKindOfClass: [NSDictionary class ]]) {
65
- NSDictionary *resultDictionary = (NSDictionary *)result;
66
- if (resultDictionary[@" error" ]) {
67
- NSMutableDictionary *errorDictionary = [NSMutableDictionary dictionaryWithDictionary: resultDictionary];
68
- errorDictionary[@" temporary" ] = @(self.response .statusCode >= 500 || self.response .statusCode < 400 );
69
- self.error = [PFErrorUtilities errorFromResult: errorDictionary];
70
- [super _taskDidFinish ];
71
- return ;
64
+ if (self.response .statusCode >= 200 ) {
65
+ if (self.response .statusCode < 400 ) {
66
+ PFCommandResult *commandResult = [PFCommandResult commandResultWithResult: result
67
+ resultString: resultString
68
+ httpResponse: self .response];
69
+ self.result = commandResult;
70
+ } else if ([result isKindOfClass: [NSDictionary class ]]) {
71
+ NSDictionary *resultDictionary = (NSDictionary *)result;
72
+ if (resultDictionary[@" error" ]) {
73
+ NSMutableDictionary *errorDictionary = [NSMutableDictionary dictionaryWithDictionary: resultDictionary];
74
+ errorDictionary[@" temporary" ] = @(self.response .statusCode >= 500 || self.response .statusCode < 400 );
75
+ self.error = [PFErrorUtilities errorFromResult: errorDictionary];
76
+ }
72
77
}
73
78
}
74
79
75
- PFCommandResult *commandResult = [PFCommandResult commandResultWithResult: result
76
- resultString: resultString
77
- httpResponse: self .response];
78
- self.result = commandResult;
80
+ if (!self.result && !self.error ) {
81
+ self.error = [PFErrorUtilities errorWithCode: kPFErrorInternalServer message: resultString];
82
+ }
79
83
[super _taskDidFinish ];
80
84
}
81
85
0 commit comments