Convert error report to perror() and return error if unsuccessful