logoalt Hacker News

epageyesterday at 9:20 PM2 repliesview on HN

I think we should provide the building blocks (display, etc like derive_more) rather than a specialized version one for errors (thiserror).

I also feel thiserror encourages a public error enum which to me is an anti-pattern as they are usually tied to your implementation and hard to add context, especially if you have a variants for other error types.


Replies

the8472yesterday at 9:44 PM

I don't quite understand the issue about public error enums? Distinguishing variants is very useful if some causes are recoverable or - when writing webservers - could be translated into different status codes. Often both are useful, something representing internal details for logging and a public interface.

show 1 reply
burntsushiyesterday at 9:29 PM

Yeah I used the weasel-y "something like" for exactly these reasons. :-)