Handle exception in controller.