News for hackers. Stuff that matters.
Re:Open-sourcing the Sorbet VS Code Extension by comp_throw7 on Sunday January 09, 2022 @02:13PM (#29866379)
Yeah, the story for handling thrown errors is much worse than it is in Java, and arguably worse than e.g. C#. But it's not a total loss:

1) 99.9%+ of the time, it'll be an instance of `Error` or some child class.

2) There's a recent compiler flag that's been added which defaults caught errors to `unknown` rather than `any`.

3) You still have access to the same tools to inspect unknown errors as you do everything else - `instanceof`, checking the presence/absence of properties, etc.

It's not great but it's something.

I would actually say the propensity of libraries to use exceptions as control flow and then _fail to document anything about those totally expected outcomes_ is a much bigger headache; that truly is an artifact of its JS inheritance.

There are no comments on this comment yet.