Skip to content

feat(errors): typed per-operation error hierarchy#540

Draft
ayushiahjolia wants to merge 1 commit into
mainfrom
feat/typed-operation-error-hierarchy
Draft

feat(errors): typed per-operation error hierarchy#540
ayushiahjolia wants to merge 1 commit into
mainfrom
feat/typed-operation-error-hierarchy

Conversation

@ayushiahjolia

@ayushiahjolia ayushiahjolia commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Issue #, if available: #120

Description of changes:

Replaces the single catch-all CallableRuntimeError with a typed, per-operation error hierarchy. A failed step, invoke, child context, or wait_for_condition now surfaces as a distinct, catchable exception type. It also lands the from_exception/throw_if_error changes those types require. The CallbackError rework and the nested-boundary regression test are intentionally deferred to follow-up PRs.

Breaking changes

  • Operation failures now raise the typed subclasses instead ofCallableRuntimeError (removed).
  • error_type holds the operation discriminator (e.g. "StepError"), not the original Python exception name; the original is available via the message and, on the first run, __cause__.
  • wait_for_condition check failures are now wrapped in WaitForConditionError rather than re-raised raw.
  • An exhausted interrupted step fails immediately as StepError rather than round-tripping through a Lambda retry.

Testing

  • Updated/added unit tests across exceptions, lambda_service, state, concurrency, and the four operation handlers.
  • Added coverage for: registry + from_error_fields (including fallback), from_exception field preservation and single-level cause-walk,raise_operation_error, wait_for_condition control-flow errors propagating unwrapped, and the step FAIL checkpoint recording the StepError discriminator.
  • Added integration test and example.

Follow-ups

  • Move CallbackError under DurableOperationError with graded subclasses (CallbackExternalError, CallbackTimeoutError, CallbackSubmitterError) and drop CALLBACK_ERROR metadata.
  • Regression test for data surviving ≥2 nested run_in_child_context boundaries

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ayushiahjolia ayushiahjolia force-pushed the feat/typed-operation-error-hierarchy branch from 5a8e07e to a92d9cc Compare July 14, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant