logoalt Hacker News

fauigerzigerktoday at 8:07 AM1 replyview on HN

>I don't think a crate should abdicate from modeling the error domain any more than they should abdicate from modeling the other types.

Yes, it's just harder. We usually have a pretty good idea what callers want from the happy path, but the range of things that callers may or may not want to do in case of an error is very broad.


Replies

zaphartoday at 12:58 PM

This is an interesting perspective. I usually don't try to imagine how someone should handle the error. Instead I try to indicate the different types of errors that could occur and what type of information needs to be included to be useful to the caller. I can leave the question of what to do with that information to the caller since it's highly situational and the context necessary to make that decision lives outside of the code where I am modeling the error.

show 1 reply