Se .catch rileva errori durante il tentativo di richiesta, perché dovrei usare Throw Error... con .catch ?
Ad esempio, a cosa serve throw Error , che .catch non gestisce automaticamente?
fetch(...).then((response) => {
if (!response.ok) {
throw Error(...)
} else {
response.json().then((responseData) => {
...
}
}
})
}
}).catch(function (error) {
console.error(error)
})