Replies: 1 comment 1 reply
-
I'd say we should be pragmatic. In this project, it is rare that we need to differentiate between the errors we throw ourselves. The overhead of adding explicit error enumerations just because a particular piece of code seems like a library may not be worth it. If such a need arises, we can always add it then, likely with little changes to the calling code. This is, unfortunately, annoying to the person needing more concrete errors in their feature. On the other hand, writing and adding new cases to the error enums is cumbersome for everyone. I'd argue the latter has more impact on the team's velocity. Some historical background - back one year ago, we didn't use This is not a strong opinion, and I'd be okay with being less pragmatic and more dogmatic if that's the team's decision. |
Beta Was this translation helpful? Give feedback.
-
I'd like to look into various error-handling options. Currently we are using a blend of generic
anyhow
errors and concrete type-safe errors. Here's one example of where we mix the two. It might not be the most interesting of examples, but imagining a scenario where we need to test various outcomes - having to validate generic errors could be suboptimal.It's really hard to make a distinction here between library code and application code as we have it all in one repo and crate, with
anyhow
as global dependency. I'm not necessarily against that, but would like to see what others are thinking about this.Here's some more fairly apparent context:
Generic errors
Upsides:
Downsides:
Concrete enum-based errors
Upsides:
Downsides:
Beta Was this translation helpful? Give feedback.
All reactions