Dont try to fetch 4bytes again in case of network errors

This commit is contained in:
Willian Mitsuda 2022-08-23 18:11:32 -03:00
parent d09fe7a023
commit 682549fa4c
No known key found for this signature in database

View File

@ -53,6 +53,7 @@ const fourBytesFetcher =
const fourBytes = key.slice(2); const fourBytes = key.slice(2);
const signatureURL = fourBytesURL(assetsURLPrefix, fourBytes); const signatureURL = fourBytesURL(assetsURLPrefix, fourBytes);
try {
const res = await fetch(signatureURL); const res = await fetch(signatureURL);
if (!res.ok) { if (!res.ok) {
console.warn(`Signature does not exist in 4bytes DB: ${fourBytes}`); console.warn(`Signature does not exist in 4bytes DB: ${fourBytes}`);
@ -70,6 +71,11 @@ const fourBytesFetcher =
signature: sig, signature: sig,
}; };
return entry; return entry;
} catch (err) {
// Network error or something wrong with URL config;
// silence and don't try it again
return null;
}
}; };
/** /**