Skip to content

WIP: Add Error::Io in order to bubble up write erros to users#713

Closed
tcharding wants to merge 2 commits intorust-bitcoin:masterfrom
tcharding:io-error
Closed

WIP: Add Error::Io in order to bubble up write erros to users#713
tcharding wants to merge 2 commits intorust-bitcoin:masterfrom
tcharding:io-error

Conversation

@tcharding
Copy link
Copy Markdown
Member

@tcharding tcharding commented Nov 23, 2021

This is a demonstration of one solution to #714. Only required if #714 is deemed to be a real issue.

Add an IO error variant so we can bubble up IO errors.
As a demonstration of usage of the new `Error::Io` bubble up the write
error from `concensus_encode` instead of using `unwrap`.
@dr-orlovsky
Copy link
Copy Markdown
Collaborator

You can't fail with a hash engine writes, so here we just have rust io::Write legacy which I am afraid can't be solved without expects: rust does not know are we writing into memory/hasher or using std::io

@Kixunil
Copy link
Copy Markdown
Collaborator

Kixunil commented Nov 23, 2021

I think we could add some lightweight version of generic Write trait and bridges to keep backwards-compatibility. Doesn't have to be crazyness like genio :)

@tcharding
Copy link
Copy Markdown
Member Author

Closing in favour of #719

@tcharding tcharding closed this Nov 24, 2021
@tcharding tcharding deleted the io-error branch August 17, 2023 02:49
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.

3 participants