@@ -61,21 +61,25 @@ - (void)_taskDidFinish {
6161 return ;
6262 }
6363
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+ }
7277 }
7378 }
7479
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+ }
7983 [super _taskDidFinish ];
8084}
8185
0 commit comments