mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Reject promise when if an error occurs while processing prefetching result
Summary: This diff rejects the promise when if an error occurs while processing prefetching result, it applies the same concept as other methods in this class (e.g. see getSizeWithHeaders) changelog: [internal][Android] Internal change in RN Image prefetching Reviewed By: JoshuaGross Differential Revision: D21295612 fbshipit-source-id: c3675e5f2d9c8e38094a538b388ff63a6ea18360
This commit is contained in:
committed by
Facebook GitHub Bot
parent
78d2b3c813
commit
e9f29a3291
@@ -9,6 +9,7 @@ package com.facebook.react.modules.image;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.util.SparseArray;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.common.executors.CallerThreadExecutor;
|
||||
import com.facebook.common.references.CloseableReference;
|
||||
@@ -58,6 +59,7 @@ public class ImageLoaderModule extends NativeImageLoaderAndroidSpec
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public String getName() {
|
||||
return NAME;
|
||||
}
|
||||
@@ -212,6 +214,8 @@ public class ImageLoaderModule extends NativeImageLoaderAndroidSpec
|
||||
try {
|
||||
removeRequest(requestId);
|
||||
promise.resolve(true);
|
||||
} catch (Exception e) {
|
||||
promise.reject(ERROR_PREFETCH_FAILURE, e);
|
||||
} finally {
|
||||
dataSource.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user