Try / catch performance recommendations

In ASP.NET, I would like your opinion on the best way to handle exceptions.

  • Do you suggest using try / catch blocks?
  • Better to use try / catch blocks for each separate piece of code / component? Or in what situations?

I really thank you for your help!

+3
source share
5 answers

You do not have to wrap each piece of code in try / catch blocks. You must catch exceptions that you can handle at any time. All other exceptions must be allowed for distribution.

, . try/catch , .

+5

try finally , , , . try catch , - . asax, .

+1

. , stackoverflow .

0

- , .

, , - , - , , , - - - go ssshhhhh.

0

try/catch , . try/catch/finally, , (, ..).

-1

Source: https://habr.com/ru/post/1763596/


All Articles