Capture exceptions.
Try {}
Catch (exception E)
{Throw new exception ("exception found ");}
1. We recommend that you capture exceptions when writing a piece of code. After capturing a piece of content, you can submit it to the outer layer or perform your own processing.
Such as writing data to a database, writing logs, and writing text. Or restart a program.
2. We recommend that you capture the entire code one by one, so that you can clearly know where the error is and facilitate debugging.
3. You can also customize the exception class to handle the exception.
4. When writing code, capture abnormal statements instead of being lazy.
5. Exceptions can be captured in database operations, writing files, Web requests, and other related program segments.
6. Overall exception Capture: when multiple exceptions are caught in the code, you can capture the code again to implement overall control.