https://stackoverflow.com/questions/9156176/what-is-the-difference-between-throw-new-error-and-throw-someobject
if (!res.ok) {
throw new Error(`HTTP response status: ${res.status}`);
}
https://lucymarmitchell.medium.com/using-then-catch-finally-to-handle-errors-in-javascript-promises-6de92bce3afc
.catch((err) => {
console.log('Error getting data', err);
})
//
No comments:
Post a Comment