check the return value of error handling function