IMHO, in the huge moajority of cases, try-catches fall into one of the following uses:
"Inner" try-catches may translate or augment the error messages and throw them again. Literally, error middlewares.
Top-level try-catches will usually display the error to user and/or send to logger and may not rethrow the error.
Not rethrowing an error in an inner try-catch is very rare, and 99% of the times, is wrong.
We still need to use exceptions. Dont misinterpret the article. Exceptions have an unique property: bubbling, and thats why they are necessary. Just dont use them where they are not meant to be used.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
IMHO, in the huge moajority of cases, try-catches fall into one of the following uses:
Not rethrowing an error in an inner try-catch is very rare, and 99% of the times, is wrong.
We still need to use exceptions. Dont misinterpret the article. Exceptions have an unique property: bubbling, and thats why they are necessary. Just dont use them where they are not meant to be used.