Miette vs anyhow/(color-)eyre

Can you offer any insight on how miette compares and contrasts with anyhow and its (color)-eyre derivatives?

1 Like

The miette crate is primarily targeted towards annotating snippets of code with some sort of error message, possibly including things like links, error codes, hints, and references to other pieces of code. Essentially, what rustc shows you when you write some code that doesn't compile. This is primarily targeted towards the end user.

The anyhow and eyre crates provide a generic mechanism for bubbling up programming errors (e.g. file not found or HTTP request timed out), and are primarily targeted towards developers so they get a useful error message when things go wrong.

5 Likes

Thanks. This clearly articulates the sort of vague impressions I was getting. Very helpful.

Would it ever make sense to use both, one to be nice to your users, and the other to be nice your developers; or would that be more trouble than it is worth?

It depends on what you are working on.

I could see something like a compiler emitting user-friendly compile errors and warnings using miette, while having fallible operations (e.g. codegen with LLVM fails for some reason) bubbled up as an anyhow error.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.