4 ms·
> If you do that and get a panic down the line... No, you don't panic, you are most likely to corrupt your data and maybe continue working as if everything wa
by junke 10y ago
> If you do that and get a panic down the line...
No, you don't panic, you are most likely to corrupt your data and maybe continue working as if everything was fine.
If you are lucky, your code panics.
> ... you already know where to start debugging.
Grep all occurrences of "_"?
> That's much better than having an exception bubble up from deeeeep inside your code with some context-less cryptic message or number, isn't it?
No, the exception carries all the context you need.
If you ignored a previous exception, the next one won't be as useful as it could, but at least your code breaks loudly.
- bsdetector 10y agoAlso "_" means the programmer chose to ignore the errors that he knew about at the time. There's no way to know whether the programmer actually considered all the error cases (they are generally very poorly documented in Go code), and there's no way to know if the called function added errors at some later date. If it's though an interface, there's no way to know that all implementations have the same errors. It's really an 80s-era approach to error handling, and that's bad.