3 ms·
Exactly! Handling null is still.. exception handling. You just check it with an if, not a try catch. But the semantics around try/catch are the main issue here
by aabhay 2y ago
Exactly! Handling null is still.. exception handling. You just check it with an if, not a try catch.
But the semantics around try/catch are the main issue here and basically everywhere in JS. Error catching in JS is absolutely abysmal. Some examples:
- nested try catch
- not annotating that a function throws an error (or even being able to annotate in TS that it does)
- async code throwing an error in a callback is uncatchable. E.G. file reader onread throwing an error.
- not being able to narrow a catch to a specific error type.