Skip to content

Commit

Permalink
Improve error message when bundled resource could not found. (#328)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
patrickkempff authored and DylanVann committed Nov 6, 2018
1 parent f8606a1 commit 7859d5b
Showing 1 changed file with 6 additions and 1 deletion.
@@ -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;
Expand Down Expand Up @@ -37,7 +39,6 @@ public FastImageSource(Context context, String source) {
this(context, source, null);
}


public FastImageSource(Context context, String source, @Nullable Headers headers) {
this(context, source, 0.0d, 0.0d, headers);
}
Expand All @@ -47,6 +48,10 @@ public FastImageSource(Context context, String source, double width, double heig
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.
Expand Down

0 comments on commit 7859d5b

Please sign in to comment.