summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-10-02 12:01:12 +0300
committerGravatar Vitaly Takmazov2019-10-02 12:01:12 +0300
commitf6f52cbd5973841e24bce5f190df75b02114df1f (patch)
treee46b4aa99432e6c2fb473d3a68292af14a07455a
parent4272a59934b65f5b0b4108b08b8d069a33d67676 (diff)
Do not ignore POST errors
-rw-r--r--Juick/APIClient.m14
1 files changed, 9 insertions, 5 deletions
diff --git a/Juick/APIClient.m b/Juick/APIClient.m
index 3332556..4652c0c 100644
--- a/Juick/APIClient.m
+++ b/Juick/APIClient.m
@@ -253,12 +253,16 @@
NSURL *url = [NSURL URLWithString:path relativeToURL:self.baseURL];
NSString *boundary = [NSString stringWithFormat:@"Boundary-%@", [[NSUUID UUID] UUIDString]];
[self fetchDataWithURL:url data:[self multipartData:params withBoundary:boundary] boundary:boundary callback:^(NSData *data, NSError *err) {
- NSError *jsonError;
- NSDictionary *jsonData = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
- if (jsonError) {
- callback(nil, jsonError);
+ if (!err) {
+ NSError *jsonError;
+ NSDictionary *jsonData = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
+ if (jsonError) {
+ callback(nil, jsonError);
+ } else {
+ callback(jsonData, nil);
+ }
} else {
- callback(jsonData, nil);
+ callback(nil, err);
}
}];
}