error handling in controllers and application