[Fix #116] Properly handle exceptions thrown from the completion functions