8000 Provide `Error` variant for wrapping other, inner Errors · Issue #517 · rpgp/rpgp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Provide Error variant for wrapping other, inner Errors #517

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

Open
wiktor-k opened this issue Apr 4, 2025 · 2 comments
Open

Provide Error variant for wrapping other, inner Errors #517

wiktor-k opened this issue Apr 4, 2025 · 2 comments

Comments

@wiktor-k
Copy link
Contributor
wiktor-k commented Apr 4, 2025

Hi,

I've got the following use-case: I'm implementing SecretKeyTrait::create_signature and it delegates to some other, external service, that can fail. When it does I can't pass the inner error (since the function requires returning rpgp Error).

Currently I'm logging the inner error and returning pgp::errors::Error::InvalidInput which, IMO, is sub-optimal.

It would be good if pgp::errors::Error had a variant that I could use to pass my inner error (e.g. Other(Box<dyn std::error::Error> ...)).

Happy to hear other ideas how to improve this situation, too.

(The code in question: https://gitlab.archlinux.org/archlinux/signstar/-/merge_requests/201/diffs#a73b577f60b6887045b9ec7e75ca81952686414f_577_581)

Thanks!

@dignifiedquire
Copy link
Member

I would recomment to use io errors with the current code, as it allows you to pass at least the string through. but will keep this in mind for the error changes I am planning

@wiktor-k
Copy link
Contributor Author
wiktor-k commented Apr 4, 2025

I would recomment to use io errors with the current code, as it allows you to pass at least the string through.

Excellent idea! I/O Error has the other function, which sounds like a good enough escape hatch for now.

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

No branches or pull requests

2 participants
0