title: Ajax error handling in CakePHP
body: <p>I want to do something very similar to <a href="http://www.intridea.com/blog/2008/7/23/using-http-status-codes-for-rails-ajax-error-handling" rel="nofollow noreferrer">this</a> but in the CakePHP world for AJAX requests.  At the moment I am doing this:</p>
  
  <pre><code>$this-&gt;autoRender = false;
  $this-&gt;response-&gt;statusCode(500);
  </code></pre>
  
  <p>It is based off of <a href="https://stackoverflow.com/questions/1100867/how-do-you-specify-an-http-status-code-in-cakephp">this</a>. However this solution does not allow me to include a custom message like in the Rails example, so that way, in my clients side error handler, I can display the message included in the 500 error response. </p>
  
  <p>How would I implement the same functionality in CakePHP like the Ruby on Rails example?</p>