simplify the _error function and rename it to pm_error