First, Java exception class introduction.
Throwable: There are two important subclasses: Exception (Exception) and error (Errors), both of which are important subclasses of Java exception handling, each of which contains a large number of subclasses.
There is a better blog,http://blog.csdn.net/hguisu/article/details/6155636 to introduce Java exceptions.
Second, the exception handling mode.
In a Java application, the exception handling mechanism is: Throw an exception, catch an exception.
Third, the use of the program.
2 Ways of Handling
1, throw new exception on the method body write throws to the upper layer, and finally to the Controller AOP processing method to log.
2. Do not use try if you know the error clearly. Catch: The way you handle processing includes logging and not throwing it to the outermost layer. Unexpected exceptions are given to Controller AOP processing. I personally am this.
The object should be data-validated and legal when it is processed by the incoming algorithm.
Java exception Handling in projects