error handling on the controller