Check return value for successful operation and report if a failure occurs