7 ms·
> I create one error type per function/action I do too! I've been debating whether I should update SNAFU's philosophy page [1] to mention this explicitly, and
by shepmaster 1y ago
> I create one error type per function/action
I do too! I've been debating whether I should update SNAFU's philosophy page [1] to mention this explicitly, and I think your comment is the one that put me over the edge for "yes" (along with a few child comments). Right now, it simply says "error types that are scoped to that module", but I no longer think that's strong enough.
[1]: https://docs.rs/snafu/latest/snafu/guide/philosophy/index.html https://docs.rs/snafu/latest/snafu/guide/philosophy/index.ht...
- nilirl 1y agoJust wanted to say, you single handedly made me a rust programmer. Your answers on stack overflow and your crates have helped me so much. Thank you!
- shepmaster 1y agoYou are quite welcome; thanks for the kind words!
- conaclos 1y agoI accept, however this requires to create many types with corresponding implementations (`impl From`, `impl Display`, ...). This is a lot of boilerplate.
- colanderman 1y agothiserror automates all of that: https://docs.rs/thiserror/latest/thiserror/ https://docs.rs/thiserror/latest/thiserror/ Highly recommended.
- conaclos 1y agoSure, but it's an additional dependency. I would prefer it if some of this machinery were added to `core`.
- shepmaster 1y agoIn addition to the sibling comment mentioning thiserror, I also submit my crate SNAFU (linked in my ancestor comment). Reducing some of the boilerplate is a big reason I enjoy using it.