Handle error in controller.