Unable to catch network error when sending request using Inertia + Vue
P粉222320176
P粉222320176 2024-03-27 15:19:23
0
1
475

I am unable to catch network errors when sending this.$inertia.patch request. I'm shutting down the backend server to simulate a lost connection. The console displays: Uncaught (in Promise) Error: Network Error.

I've tried Inertia's onError, tried adding .catch after the request and a separate try...catch and using Vue 2

errorCaptured: function(err) {
   console.log('Caught error', err.message)
},

I can provide more details if needed.

So basically trying to catch net::ERR_CONNECTION_REFUSED

Edit: I started using onFinish along with onSuccess and onStart, but ended up using axios

P粉222320176
P粉222320176

reply all(1)
P粉935883292

Use onStart with onSuccess and onFinish:

  • If a network error occurs, onFinish will fire and onSuccess.
  • If a server error occurs, onError will be triggered with onFinish
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template