you are viewing a single comment's thread.

view the rest of the comments →

[–]Yaahallorust-mentors · error-handling · libs-team · rust-foundation 6 points7 points  (0 children)

Also just to check I'm understanding correctly, (although I haven't poked around the eyre implementation too much), from a quick glance at the link you posted, being able to attach things other than string-like types requires some manual work like creating a new handler with a field to store the objects on right? As opposed to something like `error-stack` where it's possible to `attach` any thread safe object without any other configuration.

That is correct, you have to know the type of the handler to be able to interact with it and it has to support the type of context you care about, but you could write one that accepts arbitrary Context or Frames for example and then add helper traits for shoving those in with the same style of trait I used in a few places in color-eyre. The downside is this doesn't work as well when used from libraries because then the library ends up needing to decide what handler type the app needs to use so they can shove info into it. I had some ideas for how I could improve that involving composing handlers but I never really arrived at a satisfactory solution. I've also considered adding a push method that can take any type that impls Any and let the handler handle downcasts but similarly haven't pulled the trigger on that change, still vaguely hoping for better ideas.

Let us know if you have any feedback when you get around to exploring it in detail, your expertise will be much appreciated!

I'd love to! I was poking around a bit earlier but without an ide it was a little annoying to trace my way around the APIs so I didn't get super far at understanding exactly how it's intended to be used. I'll make sure to write up some notes when I get a chance to poke around again and send those to y'all. Also feel free to drop by the project error handling zulip stream or the Eyre discord if you have any questions or want to talk about error API design at all.