Check for errors and return codes.