How to handle Ember.Data model errors


Silly question. I have this action that captures model loading error, which sets a property that toggles an error message on the template.

// route/parenting.js
actions: {
  error(error, transition) {
    let errors = error.payload.errors[0];
    if (errors.status === 404) {
      this.set('controller.errorMessage', 'No content found');

So now i need to make the message go away when the request is a success. Where do i reset the controller.errorMessage property state? Doing it from the model then block like this gives me an error:

// route/parenting.js
model(params) {
  return RSVP.hash({

    // using ember-infinity
    articles: this.infinityModel('article', {
      perPage: 4,
      startingPage: 1,
      modelPath: 'controller.model.articles'
    }).then((res) => {
      // doing this throws an error:
      // Cannot read property 'errors' of undefined
      this.set('controller.errorMessage', false);
      return res;

I’m not sure this is the correct way to handle errors. But i’ve never manage to make Ember’s built-in error or article.error route to work.