test: improve task error handling