title: Yii: Catching all exceptions for a specific controller
body: <p>I am working on a project which includes a REST API component. I have a controller dedicated to handling all of the REST API calls.</p>
  
  <p>Is there any way to catch all exceptions for that specific controller so that I can take a different action for those exceptions than the rest of the application's controllers?</p>
  
  <p>IE: I'd like to respond with either an XML/JSON formatted API response that contains the exception message, rather than the default system view/stack trace (which isn't really useful in an API context). Would prefer not having to wrap every method call in the controller in its own try/catch.</p>
  
  <p>Thanks for any advice in advance. </p>