Skip to content

Commit

Permalink
Provide more info when image fails to load
Browse files Browse the repository at this point in the history
Reviewed By: javache

Differential Revision: D4209311

fbshipit-source-id: 6ad8ea6b8e236ec5ad2a2313a69b8985f9a06c74
  • Loading branch information
frantic authored and Facebook Github Bot committed Nov 21, 2016
1 parent b74da13 commit d117f55
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Libraries/Image/RCTImageLoader.m
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,11 @@ - (RCTImageLoaderCancellationBlock)_loadURLRequest:(NSURLRequest *)request
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;
}

Expand Down

0 comments on commit d117f55

Please sign in to comment.