I'm looking how to intercept API network errors. In my API I created an error if the password sent by the frontend application isn't the good one. And in my frontend application i'm trying to catch this api return and hide the network error message in the console.
So I want to get rid of this message: Message to catch
I tried to catch the error with an axios
myApi.interceptors.response.use(
response => response,
error => {
/* THE ERROR MESSAGE IS DISPLAYED BEFORE
* THE INTERCEPTOR CONSOLE.LOG
*/
console.log(error);
}
);
I also tried to use a new Promise((resolve, catch)=> {}) but the message error is still displayed before my catch.
Can anyone help me?