Example with Axios ajax callback:
... .catch((thrown) => { if (thrown.code === 'ERR_NETWORK') { alert(thrown.message); // Network Error } }) ...