checkForErrors throws the errors to the caller.