I’ve heard it is best to “throw early, catch late” when it comes to managing and handling errors.
With Typescript, I believe I’m seeing more code examples and articles which delay throwing errors until later in the execution, instead returning an Error object for handling at a high level.
Here is one such example:
Frankly, the arguments made in this make sense to me, but I’m still quite inexperienced in my error handling and coding.
I’d like to hear thoughts and experiences from others about error handling in Typescript, and whether or not the old adage should be updated?