Provide more info when image fails to load

Reviewed By: javache

Differential Revision: D4209311

fbshipit-source-id: 6ad8ea6b8e236ec5ad2a2313a69b8985f9a06c74
This commit is contained in:
Alex Kotliarskyi 2016-11-21 04:48:58 -08:00 committed by Facebook Github Bot
parent b74da13a75
commit d117f550a5
1 changed files with 3 additions and 1 deletions

View File

@ -429,9 +429,11 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
NSInteger statusCode = ((NSHTTPURLResponse *)response).statusCode;
if (statusCode != 200) {
NSString *errorMessage = [NSString stringWithFormat:@"Failed to load %@", response.URL];
NSDictionary *userInfo = @{NSLocalizedDescriptionKey: errorMessage};
completionHandler([[NSError alloc] initWithDomain:NSURLErrorDomain
code:statusCode
userInfo:nil], nil, nil);
userInfo:userInfo], nil, nil);
return;
}