Permalink
Browse files

Provide more info when image fails to load

Reviewed By: javache

Differential Revision: D4209311

fbshipit-source-id: 6ad8ea6b8e236ec5ad2a2313a69b8985f9a06c74
  • Loading branch information...
1 parent b74da13 commit d117f550a51a309069be2d15546688844bf5c9fb @frantic frantic committed with Facebook Github Bot Nov 21, 2016
Showing with 3 additions and 1 deletion.
  1. +3 −1 Libraries/Image/RCTImageLoader.m
@@ -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;
}

0 comments on commit d117f55

Please sign in to comment.