Handle exception in CLI