Here are some rules of thumb for knowing when to use try/catch :
- Do you control the input?
If the variable in question is coming from a user, an API, or some other external source, you should probably wrap its initial handling in a try/catch block.
- Is the error recoverable?
If the error is something you can recover from, like a network request fail
...
See more