1. Java exceptions include checked exceptions and unchecked exceptions.
Checked exceptionCodeTry ...... Catch display capture)
All exceptions that inherit java. Lang. Exception. It can be restored during execution. This type of exception is notProgramSuch as invalid user input and file does not exist. These are external reasons, none of which can be controlled within the program.
Unchecked exception (also called error, no need to show capture)
All exceptions that inherit java. Lang. runtimeexception. Is an error that cannot be processed.
2. Where should exceptions be recorded?
The location where the exception was first generated.
If the exception can be handled, no record will be made after the exception is processed. If an exception cannot be handled, You can encapsulate it as another exception and throw it up without record the recorded exception.
3. Recording abnormal behaviors that do not belong to the exception type should be done by a dedicated log system.
4. An exception handling framework is provided for the system to determine whether to record exceptions and how to record exceptions, rather than being done by common programmers.
5. For an application, all exceptions appear to the user as internal exceptions of the application system. Therefore, an application system exception framework should be designed to handle all exceptions during system operation.
You can design a general class for an application system, such as appexception. This exception and its subclass occur when the application system is running. Therefore, the appexception family should inherit from runtimeexception, in this way, all other exceptions in the system are transferred to appexception. When an exception occurs, the front-end will receive the appexception and perform unified processing.
6. In the general exception handling framework, support for configuration information and unified Exception Handling and exception log management are required, it also allows you to extend custom exception handling or logging methods in the form of plug-ins.