I'm using wretch to make HEAD requests in order to determine if a resource exists or not. Based on the returned status/error, I am displaying something to the user. However, I'd like wretch to not console log it's 404 in those cases. I've tried wrapping a try/catch around the call, and also using the provided callbacks, but the error gets console logged regardless.
This is what I'd like to disable to be logged:
Any ideas?
resourceDoesNotExist(url) {
return api
.url(url)
.head()
/* The next 3 lines are probably all the same */
.notFound(() => true)
.error(404, () => true)
.res((response) => {
if (/4\d\d/.test(response.status) === true) {
return true;
}
return false;
});
},
Hey,
I'm using wretch to make
HEAD
requests in order to determine if a resource exists or not. Based on the returned status/error, I am displaying something to the user. However, I'd like wretch to not console log it's 404 in those cases. I've tried wrapping a try/catch around the call, and also using the provided callbacks, but the error gets console logged regardless.This is what I'd like to disable to be logged:
Any ideas?