mirror of
https://github.com/status-im/react-native-fast-image.git
synced 2025-02-23 11:48:16 +00:00
Improve error message when bundled resource could not found. (#328)
A team member of mine spend a couple of hours debugging this error: Couldn't find com.facebook.react.uimanager.annotations.ReactProp.source. There was no clear indicator of what the underlaying problem was. As it turns out the error was caused by missing assets. To make sure other developers don't waste the same amount of time as we did, we improved the error message.
This commit is contained in:
parent
f8606a1f2e
commit
7859d5b6d9
@ -1,7 +1,9 @@
|
||||
package com.dylanvann.fastimage;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.bumptech.glide.load.model.GlideUrl;
|
||||
import com.bumptech.glide.load.model.Headers;
|
||||
@ -37,7 +39,6 @@ public class FastImageSource extends ImageSource {
|
||||
this(context, source, null);
|
||||
}
|
||||
|
||||
|
||||
public FastImageSource(Context context, String source, @Nullable Headers headers) {
|
||||
this(context, source, 0.0d, 0.0d, headers);
|
||||
}
|
||||
@ -47,6 +48,10 @@ public class FastImageSource extends ImageSource {
|
||||
mHeaders = headers == null ? Headers.DEFAULT : headers;
|
||||
mUri = super.getUri();
|
||||
|
||||
if (isResource() && TextUtils.isEmpty(mUri.toString())) {
|
||||
throw new Resources.NotFoundException("Local Resource Not Found. Resource: '" + getSource() + "'.");
|
||||
}
|
||||
|
||||
if (isLocalResourceUri(mUri)) {
|
||||
// Convert res:/ scheme to android.resource:// so
|
||||
// glide can understand the uri.
|
||||
|
Loading…
x
Reference in New Issue
Block a user