title: How to handle php notices, warnings and errors in REST api?
body: <p>In REST API a 200 response show a successful operation. PHP by default output the error message directly in the response body without changing response code. In SPAs, the response text is not directly visible to user. So when the application does not work as expected I have check response body through FireBug to check for possible PHP exceptions (which cause invalid json response). 
  Is there any way to send a specific HTTP code on all PHP errors? </p>
  
  <p>Is there any way to change the HTTP response code according to existence of any PHP errors? Or, is it possible to grab the error text and send it in json format in a hassle-free way. (in development phase)</p>
  
  <p>Update: Exception Catching (try/catch/final) is not what I am looking for.</p>