perago.result_for_exception#

perago.result_for_exception(exc)[源代码]#

Classify an exception into a worker attempt result.

The runtime uses this classifier around task invocation and publication so that exceptions are reported through a single Conductor result contract.

Parameters:
excException

Exception raised while validating input, running the task body, checking guardrails, staging workspace changes, publishing, or cleaning up an attempt.

Returns:
RuntimeTaskResult

FAILED_WITH_TERMINAL_ERROR for pre guardrail failures and FAILED for all other exceptions.

参数:

exc (Exception)

返回类型:

RuntimeTaskResult

参见

RuntimeTaskResult

Validated result model returned by this function.

PreGuardrailViolation

Exception mapped to terminal failure.

failed_result

Builder used for ordinary failed results.

terminal_failed_result

Builder used for terminal failed results.

Notes

The classifier is intentionally fail-closed. Publish fence errors, stale attempts, post guardrail failures, and user task exceptions are not converted into successful results.

Examples

>>> result_for_exception(PreGuardrailViolation("missing raw file")).status
'FAILED_WITH_TERMINAL_ERROR'
>>> result_for_exception(RuntimeError("body failed")).status
'FAILED'