How to strongly type try/catch blocks in TypeScript
--
Unfortunately Javascript does not support multiple catch(error)
to allow you to run a different code based on the error type. But, there are ways we can improve error handling in our single catch
statement to leverage the power of classes and the instanceof
operator. Lets see an example of catching different exceptions in a language such as C#.