Hacker News new | ask | show | jobs
by ColonelPhantom 915 days ago
This feels a bit strawmanny. "If you're doing err=nil in typescript, it sucks worse than Go!" Yeah, but nobody does err=nil in typescript, you just re-throw or something similar. At least that's what happens in Python land, which I'm more familiar with and also uses exceptions for error handling.

I also think most of the criticism of Go error handling is that it's a clunky and noisy implementation of the "error values" idea. Rust does the same, but instead of a (value, error) tuple they use enums that clearly discriminate between the two, and aren't afraid of providing more concise syntax for the common 're-throw' case.

1 comments

In TypeScript or Python or any other language with unchecked exceptions you will rethrow and very likely the exception will be caught by te runtime when you least expect because someone else didn't bother handling it.