jeudi 20 octobre 2016

Ember + Ember Data, Handling Error Substates at the Application Level, Ember 2.8

I'm trying to do something that sounds really simple. I want to render server errors to the outlet of my application.hbs.

Reading this doc, http://ift.tt/2dStLys, I am able to detect my errors, but I can't seem to pass the error as a model to my error.hbs by following the given pattern.

If I register the error action handler on my application route as noted, I am able to render my error.hbs template, but I cannot access the context of the error object I'm dealing with. Additionally, my URL route updates, which is not desired.

actions: {
    error(err, transition) {
        return this.transitionTo('error');
    }
}

Using this handler, I do render error.hbs to my outlet, but I don't get any context from my error object to render to that template. If I try to pass in the error as a model, I get this error:

More context objects were passed than there are dynamic segments for the route: error

Right now, whenever an error occurs loading a model, I just get a loading spinner state that hangs forever. I would like, instead, to display the server error(s).




Aucun commentaire:

Enregistrer un commentaire