title: Ember CLI + Ember Data: How to Handle Error Messages
body: <p>I am trying to provide useful feedback for the user based on the response from the server when errors occur.  By default, Ember CLI provides a template for <code>error.hbs</code>, which sets its <code>model</code> to the <code>promise</code> returned from the Ember Data <code>GET</code> call.  I have configured error conditions on my template and would like to set those conditions in a controller:</p>
  
  <pre><code>{{#if pageNotFound}}
      &lt;p&gt;Sorry.  The page you requested does not exist.&lt;/p&gt;
  {{elseif internalServerError}}
      &lt;p&gt;An internal server error occured.  Please try again.&lt;/p&gt;
  {{elseif notAuthorized}}
      &lt;p&gt;It looks like you are not authorized to view this page.  Have you registered and logged in?&lt;/p&gt;
  {{/if}}
  </code></pre>
  
  <p>I have tried setting the values via my <code>ApplicationRoute</code> with no success, <a href="http://discuss.emberjs.com/t/how-to-deal-with-route-when-model-gets-a-404/5283" rel="nofollow">as suggested here</a>:</p>
  
  <pre><code>ApplicationRoute = Ember.Route.extend(
      actions:
          error: (error, transition) -&gt;
              errorController = @controllerFor "error"
              switch error.status
                  when 404 then errorController.set("pageNotFound", true)
                  when 500 then errorController.set("internalServerError", true)
                  when 403 then errorController.set("notAuthorized", true)
                  else errorController.set("generic error", true)
              @transitionTo "error"
  )
  </code></pre>
  
  <p>But I see no transition, though the actions function triggers when I put a <code>console.log</code> in.</p>
  
  <p>How can I display conditional error messages based on the promise <code>status</code> value on a generic <code>ApplicationError</code> route and template?</p>