Curious if there is a one liner that would cover 80%+ of the error handling: onerror add context and return ; onerror function(err) and return ;
Re:Upcoming Features in Go 1.18
by sethammons on Tuesday November 09, 2021 @03:56PM
(#29167370)
Error handling differs. But we try to move up metrics and logs as high as possible in the call chain. Handling an error may be a retry with a strategy, moving items to different queues, changing concurrency, potentially triggering jobs to run, feeding different events to event streams, and, of course, retuning errors to callers so they can programmatically respond.
The rest of the error blocks do something more (attempt a fallback, add context, log something, metric something, etc). This is code base that has been worked on for about 6 years, around 40k lines of code, 32 contributors, and over 450 releases. This is a legit production mail transfer agent. Take this as an experience report on a real system: that pattern is not as common as you think. 5% is pretty low.