You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to avoid using unwrap or expect in really any of the code, aside from maybe the tests.
I likely want to write my own error types, using anyhow (for the cli only) or thiserror (for everything else; though burnsushi recommends against it).
... if one is building a library intended for others to use, I’d suggest writing out concrete error types and providing an appropriate std::fmt::Display impl.
This post suggests using the former in development, and only replacing once things are mostly done.
I want to avoid using
unwrap
orexpect
in really any of the code, aside from maybe the tests.I likely want to write my own error types, using
anyhow
(for thecli
only) orthiserror
(for everything else; though burnsushi recommends against it).This post suggests using the former in development, and only replacing once things are mostly done.
https://blog.burntsushi.net/unwrap/
https://www.lpalmieri.com/posts/error-handling-rust/#anyhow-or-thiserror
In the post above burnsushi argues against linting
unwrap
and/orexpect
, though in #132 I currently am.Examples
Zola uses
anyhow
, but basically aliases it, perhaps so it is easier to change later?https://github.com/getzola/zola/blob/9fe455892e850da0684817ae9553e61757d9e5e4/components/utils/src/fs.rs#L9
See citationberg for examples of custom error types.
The text was updated successfully, but these errors were encountered: