def METHOD_NAME(self, task, script, err):
    line_number, error_line = self.get_error_line_number_and_content(script, err)
    if isinstance(err, SpiffWorkflowException):
        err.line_number = line_number
        err.error_line = error_line
        err.add_note(f"Python script error on line {line_number}: '{error_line}'")
        return err
    detail = err.__class__.__name__
    if len(err.args) > 0:
        detail += ":" + err.args[0]
    return WorkflowTaskException(detail, task=task, exception=err, line_number=line_number, error_line=error_line)