The .catch() method in your fetch will not be able to handle a 4xx or 5xx response from the server.
This is handled in the .then() method.
.then((res) => {
if (res.status === 500) // handle server error here
if (res.status === 400) // handle bad request error here
})
the catch in fetch will only see a network error.
posts-project/public/js/domSignup.js
Line 176 in 543acb9
The
.catch()method in your fetch will not be able to handle a 4xx or 5xx response from the server.This is handled in the
.then()method.the catch in fetch will only see a network error.