Seal error types.
partim opened this issue · comments
Plenty of error types are currently public enums. This leads to the necessity of breaking changes any time their content needs to be adjusted. Instead, we should use private enums inside newtypes.
Doesn't using #[non_exhaustive]
for the enums cover this?
Yes. I currently think the strategy should differ for error types that convey information that may be useful for the caller (as in: they may want to do different things depending on what went wrong) and those that will essentially only ever lead to cancelling an operation. For the former, the non-exhaustive attribute is probably the right choice.