Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion Sources/BranchSDK/BNCServerInterface.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,24 @@ - (void)genericHTTPRequest:(NSURLRequest *)request retryNumber:(NSInteger)retryN
NSError *error = [NSError branchErrorWithCode:BNCVPNAdBlockerError];
[[BranchLogger shared] logError:[NSString stringWithFormat:@"Possible VPN Ad Blocker. Giving up on request with HTTP status code %ld. Underlying error: %@", (long)status, underlyingError] error:error];
} else {
[[BranchLogger shared] logWarning: [NSString stringWithFormat:@"Giving up on request with HTTP status code %ld", (long)status] error:underlyingError];
// If a network request is successful, the `data` field will be populated with the error response from the service
// We have to create an NSError object here to pass down to callback.

if(serverResponse.data && serverResponse.data[@"error"] != nil){
id errorJson = serverResponse.data[@"error"];

if(errorJson[@"message"] != nil){
NSString *errorString = errorJson[@"message"];
NSDictionary *userInfo = @{
NSLocalizedDescriptionKey: errorString,
};
underlyingError = [NSError errorWithDomain:[NSError bncErrorDomain]
code:[(errorJson[@"code"]) integerValue]
userInfo:userInfo];
}
}

[[BranchLogger shared] logError: [NSString stringWithFormat:@"Giving up on request with HTTP status code %ld", (long)status] error:underlyingError];
}
}

Expand Down
Loading