5 ms·
I do too. Error handling is fine-ish mostly. The issue I have is there are three forms of error handling. Errors : Fine. Panics : Weird because golan
by bb88 3y ago
I do too. Error handling is fine-ish mostly. The issue I have is there are three forms of error handling.
Errors : Fine.
Panics : Weird because golang already had errors.
Segfaults: Gah! (though this is a cgo issue apparently)
See
https://news.ycombinator.com/item?id=37908655 https://news.ycombinator.com/item?id=37908655
and
https://rachelbythebay.com/w/2023/10/16/env/ https://rachelbythebay.com/w/2023/10/16/env/
- randomdata 3y ago> Panics : Weird because golang already had errors. It is true that panic allows any value to propagate, so technically you can use it to carry errors, along with anything else you can imagine (names, email addresses, audio, whatever). But the intent is for it to be used for communicating exceptions. You will notice panic's behaviour mirrors exception handling systems found in some other popular languages. But errors, along with names and email addresses for that matter, are decidedly not exceptional.
- Cthulhu_ 3y agoPanics are discouraged to use though, or, only when you intend to have the whole app crash immediately, which is rarely the case. It's there, but you shouldn't use them in practice.
- metaltyphoon 3y agoPanics recovery should almost always be used on web services. You do want them to crash a web server.