Add basic error detection and raise an exception for failed synchronous tasks.