4 ms·
> 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 w
by 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.