Skip to content

fix: make Resend API errors picklable - #278

Open
nickita-khylkouski wants to merge 1 commit into
resend:mainfrom
nickita-khylkouski:fix/error-pickling
Open

fix: make Resend API errors picklable#278
nickita-khylkouski wants to merge 1 commit into
resend:mainfrom
nickita-khylkouski:fix/error-pickling

Conversation

@nickita-khylkouski

@nickita-khylkouski nickita-khylkouski commented Sep 10, 2026

Copy link
Copy Markdown

Summary

Define ResendError#__reduce__ so API errors can be pickled without calling subclass constructors with incomplete Exception.args. The round trip preserves the concrete exception type, args, message, headers, and error metadata.

Testing

  • Full pytest suite: 674 passed
  • mypy: 181 source files, no issues
  • flake8 passed under the repository's supported Python 3.11 environment
  • Package build passed

Summary by cubic

Makes ResendError picklable by adding __reduce__, so API errors can be serialized and restored with the same concrete type, args, message, headers, and error metadata. Previously pickling could reconstruct errors with incomplete Exception.args, losing custom state.

Adds pickle round-trip tests across all supported pickle protocols and common error type/code combinations.

Written for commit 31a7dc4. Summary will update on new commits.

Review in cubic

@github-actions github-actions Bot added the linear-synced PR has been synced to Linear label Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linear-synced PR has been synced to Linear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant