Inertia doesn't handle cases when a request fails without a response (e.g. no network).
In that case the error.response is null.
https://github.com/inertiajs/inertia/blob/70b6bda4f23061558d48f91a95baaa9062b9e0bb/src/inertia.js#L83
Suggestion before line 83:
} else if (!error.response) {
Progress.stop()
// Should the user be notified somehow?
}
Perhaps an API to catch errors would be a great addition. With an interception API you would be able to catch no network errors etc. 馃檪
let api = Inertia.init(...);
api.interceptors.response.use((response) => response, (error) => {
// whatever you want to do with the error
});
It might even solve the highly requested feature: custom progress bar?
api.interceptors.request.use((config) => {
MyProgress.start()
return config;
});
api.interceptors.response.use((response) => {
MyProgress.done()
return response;
}, (error) => {
MyProgress.fail();
});
+1 for that. I would really love to see the solution for this.
I'm getting this error in Sentry very often.

+1 Same here
Thanks for reporting this. I agree, we need a better solution here. I plan to get back into some serious Inertia development in June, and I'll try and tackle this at that time. 馃憤
So I believe this has been corrected now. In the event that there is no response, the promise will simply fail, without causing another error.

Plus, you can now catch these errors using the new event system:
import { Inertia } from '@inertiajs/inertia'
Inertia.on('error', event => {
console.log(`An unexpected error occurred during an Inertia visit.`)
console.log(event.detail.error)
// Prevent the error from being thrown
event.preventDefault()
})
Most helpful comment
Thanks for reporting this. I agree, we need a better solution here. I plan to get back into some serious Inertia development in June, and I'll try and tackle this at that time. 馃憤