superconsole icon indicating copy to clipboard operation
superconsole copied to clipboard

Consider not using anyhow::Error

Open wilfreddenton opened this issue 2 years ago • 2 comments

I recently started using superconsole and I really like it. Thanks for making this! 🙏

The use of anyhow presents a bit of an ergonomics problem however. For example, in my application I use eyre and I have to manually map_err your anyhow errors to eyre::Reports. It seems that under the hood you are using thiserror to define errors. Perhaps these could be brought up to the surface instead of wrapping them in anyhow::Error?

wilfreddenton avatar Apr 04 '23 18:04 wilfreddenton

One of the challenges is that superconsole needs to propagate errors up from Components. I guess we could resolve that by Component still using anyhow::Result and wrapping any errors in some superconsole error type. I think a better approach may be for the user to configure superconsole with the error type that they want (probably requiring that there's a From<SuperConsoleError> for it). I think this would fit nicely with the solution for the #6.

cjhopman avatar Apr 04 '23 18:04 cjhopman

@stepancheg - given the solution to #6 is now landed, how easy it is to do the error generalisation?

ndmitchell avatar Jun 04 '23 19:06 ndmitchell