Improve error handling in ingest task