Transitioning when encountering an error

Hi, I am trying to do this.transitionTo(‘routename’) in the ApplicationRoute error action

What seems to happen is when I click on the link, it hits the error, and doesn’t transition to the target route, it seems to say it’s transitioning to the route it was just in again. This is using {{#link-to}} so I have a feeling there is some magic going on in there…

I am trying to use this example

The error is happening in the model() method on the route (which is using jquery and returning a promise [jqXHR]) because I am returning a 401 http code

Is this not correct?

App.ApplicationRoute = Ember.Route.extend(
    actions:
        error: (error, transition) ->
            if error.status == 401
                @transitionTo('login')
)

Another thing I’ve tried is setting the .ajaxError method and transitioning in there but the result seems to not transition too

App.ApplicationRoute = Ember.Route.extend(
    setupController: (controller, model) ->
        route = @
        Ember.$(document).ajaxError((event, jqXHR, ajaxSettings, error) ->
            if jqXHR.status == 401
                route.transitionTo('login')
        )

        controller.set('content', model)
)

Has anyone got this working on ember 1.2.0?

Turns out it was an issue on my end, I was countering my transition elsewhere!