Skip to content

feat: make sure the error kind is properly transferred when serializing io errors #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 11, 2025

Conversation

rklaehn
Copy link
Collaborator

@rklaehn rklaehn commented Jul 11, 2025

Description

I now go through a lot of effort assigning good error kinds and don't want them to be lost!

Breaking Changes

None, except the rpc API will behave slightly differently. But we don't care for that level of stability yet!

Notes & open questions

Note: you can cast an ErrorKind to u32, but the order in the enum is not stable. Hence the boilerplatey match.

Fixes #110

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.

…errors.

I now go through a lot of effort assigning good error kinds and don't want them to be lost!
Copy link

github-actions bot commented Jul 11, 2025

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh-blobs/pr/111/docs/iroh_blobs/

Last updated: 2025-07-11T09:33:12Z

Copy link
Member

@matheus23 matheus23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh, I wish there were a way to check for future variants that might get added and have a test failing or sth like that. But with #[non_exhaustive] and no way of listing all current types of errors, I wouldn't know how.

(perhaps some hackery with mem::transmute between u32 and ErrorKind and counting up until it fails? 😅 )

@rklaehn
Copy link
Collaborator Author

rklaehn commented Jul 11, 2025

Eh, I wish there were a way to check for future variants that might get added and have a test failing or sth like that. But with #[non_exhaustive] and no way of listing all current types of errors, I wouldn't know how.

(perhaps some hackery with mem::transmute between u32 and ErrorKind and counting up until it fails? 😅 )

Yeah, I actually tried to leave out the _ case, but the compiler shouted at me due to non_exhaustive...

@rklaehn rklaehn merged commit a3ea700 into main Jul 11, 2025
25 checks passed
@rklaehn rklaehn deleted the preserve-io-error-kind branch July 11, 2025 09:50
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.

Make sure the error kind is properly serialized in the rpc api
2 participants