Skip to content
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

Add anyhow/eyre interop example #123

Closed
virtualritz opened this issue Feb 24, 2022 · 7 comments
Closed

Add anyhow/eyre interop example #123

virtualritz opened this issue Feb 24, 2022 · 7 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Extra attention is needed

Comments

@virtualritz
Copy link
Contributor

The docs state that Report is an "anyhow/eyre-compatible error wrapper type" I couldn't find any example showing how this works.

I expected to be able to call into_diagnostic() on anyhow::Error after reading this but this doesn't work.

An example would be highly appreciated – maybe add one for eyre too, while at it. Cheers!

@zkat
Copy link
Owner

zkat commented Feb 24, 2022

Oh nono, what this means is that you can swap your use eyre::Report for use miette::Report and have that kinda work most of the time. Probably worth clarifying.

@zkat zkat added documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Extra attention is needed labels Feb 24, 2022
@virtualritz
Copy link
Contributor Author

Yes, maybe something like:

Report is a drop-in replacement error-wrapper type for anyhow/eyre::Report with similar/same semantics/ergonomics.

?

@virtualritz
Copy link
Contributor Author

I am happy do a PR – i.e. change the README text similar to the above and add notes to the docs for miette::Result/Report and miette! regarding those being viable replacements for those in anyhow/eyre.

Just to clarify – what I understand:

  1. miette::Result and miette::miette! are replacements for anyhow::Result/eyre::Result and anyhow::anyhow!/eyre::eyre!

  2. miette::Report is a replacement for eyre::Report

Correct?

@zkat
Copy link
Owner

zkat commented Feb 24, 2022

that's correct!

@virtualritz
Copy link
Contributor Author

So, spent a bit of time on this (#124) – such a nice crate deserves polished docs. 🤩

@virtualritz
Copy link
Contributor Author

Btw., is the 1st sentence of the README a Cordwainer Smith reference 'haiku'?

@zkat
Copy link
Owner

zkat commented Feb 25, 2022

it's a reference to this tweet: https://twitter.com/TriciaLockwood/status/1108102037072433153

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants