Handle exception in controller