You can try this for error handling with fetch ()
// Handling Internet Errors handleErrors(response) { if (!response.ok) { throw Error(response.statusText); } return response; } fetch(/*"url"*/) .then(this.handleErrors) .then(response => console.log("ok") ) .catch(error => console.log(error) );
source share