4 ms·
* If it's an actionable error, catch it as low as you can action on it. Otherwise let it propagate. * If it's a useful error for another developer (or yoursel
by AdamN 4y ago
* If it's an actionable error, catch it as low as you can action on it. Otherwise let it propagate.
* If it's a useful error for another developer (or yourself) to see, log it.
* Use different loglevels in your code so another developer (or yourself) can increase or decrease the verbosity of your logging in different environments and under different circumstances.
- ParetoOptimal 4y ago> If it's an actionable error, catch it as low as you can action on it Don't you lose context and the ability to give a more specific error message by catching low?
- sethammons 4y agosometimes, yes. Also, sometimes you lose context by logging too high. It is a Goldilocks thing. What I've started wanting is a system where you attach key-value pairs to an error condition and that error bubbles up to as high in the stack as possible and then reports the error with all key-value pairs that it picked up on the propagation back up the stack.