transitionTo without URL update

I am trying to implement a few different error page inside my app. In the application template I am doing the following:

    error(error, transition) {
        console.error(error);
        if (error && error.errors && error.errors[0] && error.errors[0].status === "403") {
            this.transitionTo('forbidden');
        } else if (error instanceof Ember.Error) {
            this.transitionTo('error');
        } else {
            this.transitionTo('error');
        }
    }

This works, but changes window location. I would like the location to stay the same, so a refresh on the site would try to load the last page accesses and not just refresh the error page.

Whats the best way to do this? I tried replacing transitionTo with render, but it gives a wierd error: Uncaught TypeError: Cannot read property ‘push’ of undefined

If you want to keep the same URL, rather than transitionTo, you might want to identify the status code and render the appropriate template (via renderTemplate) on the error route.

2 Likes

@tsantos83 is right.

just leave the link to api method call.