Remove unnecessary error checks

These checks cause problems because the public API actually allows passing error=NULL, which is then handed to these functions.