3 ms·
In my experience there are usually only a few places in an application that actually care about errors. You typically have something near the top level that rep
by thayne 3y ago
In my experience there are usually only a few places in an application that actually care about errors. You typically have something near the top level that reports errors to the user or client, whether that is printing to stderr, showing a dialog, or returning an error response over the network. You might have something that logs errors. That might be in the same place you report to the user, or it might happen where errors originate. At some boundaries, especially between a library and the calling application it might wrap the original error in a different error. If you have retries, that is probably handled by a framework that in turn returns errors if the retries fail. And maybe in some rare cases you can gracefully degrade or try an alternative in the case of an error. Everywhere else, you probably just want to propagate it up the top level error reporting facility.
I don't think you should blindly pass up all errors, but IME propagating upwards is usually the right thing to do in your middle layers.
- deleted 3y ago[deleted]