improved docstring for error_check function