Skip to content

fix(errors): native errors name dynamoxy.errors as their module - #145

Merged
kalaspuff merged 1 commit into
mainfrom
fctl/152-when-making-connections-without-any-cred
Oct 31, 2026
Merged

kalaspuff merged 1 commit into
mainfrom
fctl/152-when-making-connections-without-any-cred

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The error classes raised by the Rust core (AccessDeniedError, ThrottlingError, ValidationError, ResourceNotFoundError, …) are the same classes dynamoxy.errors exports, so except dynamoxy.errors.AccessDeniedError already caught them, but they named the native module as theirs: tracebacks showed _core.AccessDeniedError (dynamoxy._core.AccessDeniedError since #72) while the Python-defined errors showed dynamoxy.errors.ItemAlreadyExistsError. They now name dynamoxy.errors, so a failed call without valid credentials ends in dynamoxy.errors.AccessDeniedError: ListTables failed: UnrecognizedClientException: …. dynamoxy.errors re-exports every native class, so pickle finds them there, and pickles written with the old module name still load because dynamoxy._core keeps the classes.

Verified with the unit test that round-trips every native error class, which now also checks its module, that dynamoxy.errors holds that very class, and the traceback line; by calling list_tables() on AWS with invalid credentials; and with make check.

Worth confirming

fctl session


Note

Low risk. It only changes the module name the native error classes report; the classes, their hierarchy and except matching stay the same. Pickles use the new module name, and old pickles still load because dynamoxy._core keeps the classes.

What it does. The error classes raised by the Rust core (AccessDeniedError, ThrottlingError, ValidationError, and so on) now name dynamoxy.errors as their module instead of dynamoxy._core. Tracebacks then show dynamoxy.errors.AccessDeniedError like the Python-defined errors, and pickle finds the classes in dynamoxy.errors, which re-exports them. The unit test, the guide and the unreleased changelog entry are updated to match.

fctl review's first look at 40d85ad · 4 files, +34 −25 · Review agent settings

The error classes raised by the Rust core (AccessDeniedError, ThrottlingError,
ValidationError, ...) are the classes dynamoxy.errors exports, but they named
dynamoxy._core as their module, so tracebacks showed
dynamoxy._core.AccessDeniedError next to dynamoxy.errors.ItemAlreadyExistsError
for the Python-defined ones. They now name dynamoxy.errors, which re-exports
them, so pickle still finds them.

Co-authored-by: Carl Oscar Aaro <[email protected]>
@kalaspuff
kalaspuff merged commit 6718c07 into main Oct 31, 2026
22 checks passed
@kalaspuff
kalaspuff deleted the fctl/152-when-making-connections-without-any-cred branch October 31, 2026 13:26
kalaspuff added a commit to kalaspuff/fanferro that referenced this pull request Oct 31, 2026
## Summary

The error classes raised by the Rust core (`AccessDeniedError`,
`ResourceNotFoundError`, `ThrottledError`, `ValidationError`, …) are the
same classes `fanferro.errors` exports, so `except
fanferro.errors.AccessDeniedError` already caught them, but they named
`_core` as their module, a name that cannot be imported. Tracebacks
showed `_core.AccessDeniedError` while the Python-defined errors showed
`fanferro.errors.ProvisioningError`; the `error_type` of events and of
the `fanferro.dead-letter` metadata, and OpenTelemetry's `error.type`,
recorded `_core.AccessDeniedError`; and pickling one failed with
`PicklingError: Can't pickle <class '_core.AccessDeniedError'>: No
module named '_core'`, so an error raised in a worker process or a task
queue could not reach its caller. They now name `fanferro.errors`, so
tracebacks end in `fanferro.errors.AccessDeniedError: …`, and pickle
finds the classes there and keeps their attributes (`code`,
`request_id`, `retryable`, …).

This follows dynamoxy's change of the same name. Verified with a unit
test that, for every native error class, checks its module, that
`fanferro.errors` holds that very class, the traceback line,
`error_type` and a pickle round trip, and one that pickles a
`ResourceNotFoundError` from the memory broker with its AWS attributes;
`make check`'s steps pass (cargo fmt and clippy, ruff, pyrefly, the
consistency checks and `uv run pytest`).

`BatchPublishError` and `ProvisioningError`, defined in Python with a
second constructor argument, still cannot be unpickled, as before: #164
tracks that.

- kalaspuff/dynamoxy#145

## Worth confirming

- **Decision:** The `error_type` value in `fanferro.dead-letter`
metadata, events and OpenTelemetry spans changes from
`_core.AccessDeniedError` to `fanferro.errors.AccessDeniedError`.
Dashboards or alerts that match the old string need updating; I did not
treat it as a breaking change, since `_core.…` was never a name an
application could import.

[fctl session](https://app.fctl.sh/s/ses_01M69NKFXEW5AAV8A1AK2Y1NBQ)

<!-- FCTL_REVIEW_SUMMARY -->
---

> [!NOTE]
> **Low risk.** It only changes the module name recorded on the native
error classes; the classes, hierarchy and catching behavior stay the
same, and the only visible difference is the `error_type` string.
>
> **What it does.** The error classes raised by the Rust core now name
`fanferro.errors` as their module instead of the unimportable `_core`.
Tracebacks show the public name and the errors can be pickled with their
attributes. A test checks every native error class, and the errors
reference and module docs are updated.
>
> **error_type string changes.** The `error_type` in events, dead-letter
metadata and OpenTelemetry `error.type` changes from
`_core.AccessDeniedError` to `fanferro.errors.AccessDeniedError`, so
dashboards or alerts matching the old string need updating.
>
> <sub>[fctl
review](https://app.fctl.sh/s/ses_01M69P7RETV4MFACJ4NVT8D1MV)'s first
look at
[`be8af87`](be8af87)
· 4 files, +72 −16 · [Review agent
settings](https://app.fctl.sh/p/fanferro?tab=reviews)</sub>

<!-- /FCTL_REVIEW_SUMMARY -->

Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
Co-authored-by: Carl Oscar Aaro <[email protected]>
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