dimanche 6 mars 2016

Ember -- JSON API Adapter Error Handling

I want to take a specific action when an API request results in a 404 error. I've read that the best way to do this is something like this in the application adapter:

  handleResponse: function(status, headers, payload){
    if(status === 404 && payload.errors){
      //handle error
    }
    return this._super(...arguments);
  }

The problem is, as soon as I set up the adapter, it won't finish loading the page so I can handle the error on the page itself. Instead it automagically takes me to some error route that just says "Adapter error". How can I stop/override this behaviour?




Aucun commentaire:

Enregistrer un commentaire