2 ms·
Why do you think nobody wraps exceptions? Everyone did in every project in every language I've worked on. Every rest API client library will wrap the http libr
by riffraff 3y ago
Why do you think nobody wraps exceptions? Everyone did in every project in every language I've worked on.
Every rest API client library will wrap the http library errors which will wrap network errors.
Languages even directly support the notion of keeping a reference to the original exception.
If anything, people do it too much.
- berkes 3y agoThere's always that edge case, say "FileReadTimedOut" presented as a UncaughtServerError that no developer ever knew the existence of, let alone thought to wrap it (in, say, the LogoStorage). With Rust this situation is impossible. Unexpected errors are made impossible by the type checker, a dev must handle it. Sure, a dev may say "meh, I'll just .into() (or wrap, if you want) any error that file-io gives into NotFound" but she does so knowingly and actively.