I’m developing an offline first web application using a service worker. When offline if a user clicks a link then here is what currently happens…
The route model hook fires. The service worker has nothing in cache and returns a 503 response. The json API adapter returns an error which bubbles up to the application route and my global error handler displays an error message saying that the user is offline.
The problem: The url has not been updated. Because my route threw an error the transition was aborted and the URL never updated.
What I want: If a route model hook errors out then I want the URL to be updated and show an appropriate error message. With the URL updated the user could reload the page when back online and get the content they expected.
In my application route I have the following action
error(error, transition) {}
Is it possible to find the URL the transition was attempting to go to?