Better error handling. When an exception is thrown inside an action, we redirect to:
 * the index page in case of html
 * internal server error and info about the exception in case of API calls