4 ms·
Very little error logic in the context of a sessionless server requires handling close to the point of error - requests should either succeed or fail en mass fo
by barrkel 7y ago
Very little error logic in the context of a sessionless server requires handling close to the point of error - requests should either succeed or fail en mass for easier reasoning and retry from the client end, which means no recovery.
Which means you need to abort when you find an error condition, and roll back everything, all the way up the stack.
The more stateful your problem domain, the more likely you need recovery logic, and error codes start becoming more useful. Add in nondeterminism and error conditions are non-exceptional and exceptions are often not the best model for them.
- JulianMorrison 7y agoSo how you do it is kind of Erlang style: Signal a channel "I died", log it, and die. You don't have to think in N-layers-deep call stacks, that's a Java way of thinking. Log the problem in sufficient detail where you found it, and stop. This is probably a use case for Go's panic and recover mechanism, where you actually do want to blow away a whole piece of the running code.