Skip to content

#200 Add detailed error message for iOS onError function. #940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public boolean onLoadFailed(@androidx.annotation.Nullable GlideException e, Obje
ThemedReactContext context = (ThemedReactContext) view.getContext();
RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
int viewId = view.getId();
eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, new WritableNativeMap());
WritableMap errorEvent = new WritableNativeMap();
errorEvent.putString("error", e != null ? e.getMessage() : "Load Failed");
eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, errorEvent);
eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
return false;
}
Expand Down
4 changes: 3 additions & 1 deletion ios/FastImage/FFFastImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ - (void) downloadImage: (FFFastImageSource*)source options: (SDWebImageOptions)o
if (error) {
weakSelf.hasErrored = YES;
if (weakSelf.onFastImageError) {
weakSelf.onFastImageError(@{});
weakSelf.onFastImageError(@{
@"error": [NSString stringWithFormat: @"%@", error]
});
}
if (weakSelf.onFastImageLoadEnd) {
weakSelf.onFastImageLoadEnd(@{});
Expand Down