You can try to handle the error yourself and actually trigger a Promise.reject()
. Something like this
fetch("https://httpstat.us/500", {
method: "head",
mode: "no-cors"
})
.then(status)
.then(res => res.json())
.catch(function(error) {
console.log("Error", error);
});
function status(response) {
if (response.ok) {
return response;
}
return response.json().then(res => Promise.reject(res));
}