A novel method, system, device, and medium for defining an anomaly

CN122508352APending Publication Date: 2026-08-04GUANGZHOU YUNBIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGZHOU YUNBIAO NETWORK TECH CO LTD
Filing Date
2026-03-27
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

例如,0可能表示运行成功,1可能表示某种类型的错误,但如果没有统一规划或管理,可能会导致开发中的冲突和混淆

Benefits of technology

[0034]与现有技术相比,本发明提供了一种新型的异常定义处理方法、系统、设备及介质,具备以下多方面的有益效果:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122508352A_ABST
    Figure CN122508352A_ABST
Patent Text Reader

Abstract

This invention discloses a novel exception definition and handling method, system, device, and medium. The exception handling mechanism provided by this invention effectively integrates the control of return value mechanisms and the automation advantages of ordinary exception mechanisms through structured exception definitions, flexible import and naming mechanisms, concise and unified syntax, exception objects supporting structured data, and reliable propagation and cleanup strategies, while avoiding the main drawbacks of both. This invention is particularly suitable for medium to large-scale software projects, framework development, and systems with high reliability requirements, significantly reducing the development cost of error handling and improving code quality and team collaboration efficiency. In summary, this invention provides an advanced exception handling system design and implementation method deeply integrated into programming languages, offering an efficient, elegant, and scalable new path to solve the long-standing error management problem in the software engineering community, possessing extremely high industrial application value and broad market prospects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of software development technology, specifically to a novel exception definition and handling method, system, device, and medium. Background Technology

[0002] In modern software development systems, exception handling mechanisms are an indispensable component. They are primarily used to capture and handle various problems that may arise during development. A well-designed exception handling mechanism can ensure system stability, improve error localization efficiency, and enhance software maintainability. However, for most developers, designing a simple and efficient exception handling mechanism that is both versatile and simplifies their workload has always been a key focus and continuous optimization point for designers.

[0003] Currently, common exception handling mechanisms are mainly divided into two types: return value-based mechanisms and ordinary exception handling mechanisms. These two mechanisms are widely used in practical development, each with its own advantages and disadvantages.

[0004] (1) Return value-based exception handling mechanism: In this approach, developers define their own error codes (usually a return value). Developers write logic code to judge and handle these error codes, ensuring that the program terminates or continues in a controlled manner when encountering problems. At the same time, developers also need to design an additional mechanism for identifying and managing these error codes. Under this mechanism, error code management becomes a very important part of exception handling. Developers usually need to define globally unique error codes and ensure that error codes do not conflict between different modules. For example, 0 may indicate successful execution, and 1 may indicate a certain type of error, but without unified planning or management, it may lead to conflicts and confusion during development. In addition, developers not only need to design their own error identification rules, but also need to pass these error codes layer by layer, from the code segment where the error occurred to the user interface layer, which may lead to cumbersome or even redundant code.

[0005] Return value-based exception handling mechanisms have the following drawbacks: Developers need to manage multiple tasks during the coding process, including completing business logic and designing error codes, managing their uniqueness and conflicts. The design and propagation of error codes themselves increase code complexity, requiring developers to explicitly propagate these error codes at each level, further increasing development complexity. Error codes are prone to duplication or conflict due to poor design or management, leading to unexpected program behavior. To implement a complete error handling process, the code needs frequent checks related to error codes, resulting in verbose and difficult-to-maintain code.

[0006] The main advantages of exception handling mechanisms based on return values ​​are: lower implementation difficulty. For interpreter developers, since errors are directly identified through return values, the interpreter implementation logic is simple and does not require additional underlying mechanism support.

[0007] (2) Standard Exception Handling Mechanism: To further avoid the hassle of developers manually passing error codes and improve the efficiency of exception handling, modern programming languages ​​have introduced a standard exception handling mechanism. This mechanism is a significant improvement over the return value mechanism. Exception passing no longer requires explicit implementation by the developer; instead, it is handled by the interpreter by default. Developers only need to focus on exception catching and logical processing. In a sense, this reduces the burden on developers, making program error handling more automated.

[0008] However, conventional exception handling mechanisms also have some shortcomings: current exception handling mechanisms typically only support basic data types (such as strings) to represent exception information, making it difficult to meet developers' needs for conveying complex exception information through structured data. To implement complex business logic, developers still need to define the meaning of each possible exception and catch them one by one; the granular control and classification of exceptions still require manual work. This easily leads to poor exception traceability and lengthy processing code. The lack of clear exception classification and standardized definitions means that developers still bear a significant portion of the tedious work in the exception handling process.

[0009] The main advantages of a standard exception handling mechanism include: developers do not need to explicitly pass error messages; the interpreter automatically handles exception propagation, avoiding redundant logic of passing error codes layer by layer. For exceptions that developers do not need to concern themselves with or handle, the interpreter can directly ignore or exit, reducing the workload of development to some extent.

[0010] In summary, while both return value mechanisms and ordinary exception handling mechanisms provide solutions for software development, many problems remain unresolved in existing technologies. Return value mechanisms offer greater flexibility but can lead to verbose code, low maintainability, and susceptibility to errors; ordinary exception handling mechanisms improve automation and development convenience but still suffer from issues such as disorganized exception classification and complex exception definitions.

[0011] Given the above problems, it is of great significance to provide a new exception handling mechanism. Summary of the Invention

[0012] (a) Technical problems to be solved

[0013] To address the shortcomings of existing technologies, this invention provides a novel exception definition and handling method, system, device, and medium. This invention integrates the advantages of the two existing exception handling mechanisms while avoiding their main drawbacks, aiming to build a concise and efficient error handling framework for developers. Through multi-layered exception classification and automatic propagation mechanisms, this invention reduces the burden on developers while improving code maintainability and robustness. Furthermore, by optimizing data types, exception definitions, and operations in the exception handling process, this invention makes exception handling development more streamlined and efficient, effectively reducing development complexity and providing crucial guarantees for the stability and scalability of software systems.

[0014] (II) Technical Solution

[0015] To solve the above-mentioned technical problems, the present invention provides the following first aspect of the technical solution: a novel exception definition processing method, comprising the following steps:

[0016] S1. Define exception types using the Flaw keyword;

[0017] S2. Import exception types using the Import statement;

[0018] S3. Throw exceptions using the Throw keyword;

[0019] S4. Capture and handle exception types.

[0020] Preferably, step S1 further includes: implementing exception type inheritance through the Inherits keyword to construct a structured exception type tree.

[0021] Preferably, step S2 further includes: defining aliases and / or placeholders for the imported exception types using the Import statement.

[0022] Preferably, in step S4, exception types are captured and processed in single-line or multi-line form by combining Let statements with Catch clauses.

[0023] Preferably, in step S4, a specific exception type or multiple exception types are captured and processed by combining a Let statement with a Catch clause.

[0024] Preferably, in step S4, the exception type of the code block is captured and processed through the “Try...Catch...Finally...Endtry” structure.

[0025] Preferably, the novel exception definition handling method further includes: uncaught exception types are automatically propagated up the call stack until they are caught or the program terminates.

[0026] To solve the above-mentioned technical problems, the present invention provides the following second aspect of the technical solution: an exception definition processing system based on the above-mentioned first aspect of the technical solution, comprising:

[0027] The exception definition module is used to define exception types using the Flaw keyword;

[0028] The exception import module is used to import exception types via the Import statement;

[0029] The exception throwing module is used to throw exception types using the Throw keyword;

[0030] The exception capture and processing module is used to capture and process exception types.

[0031] To solve the above-mentioned technical problems, the present invention provides the following third aspect of the technical solution: an electronic device, including a memory and a processor coupled to each other, wherein the memory stores program instructions and the processor is used to execute the program instructions to implement the novel exception definition processing method of the first aspect of the technical solution described above.

[0032] To solve the above-mentioned technical problems, the present invention provides the following fourth aspect of the technical solution: a computer-readable storage medium storing program instructions thereon, wherein when the program instructions are executed by a processor, a novel exception definition handling method as described in the first aspect of the technical solution above is implemented.

[0033] (III) Beneficial Effects

[0034] Compared with existing technologies, this invention provides a novel method, system, device, and medium for handling exception definitions, which has the following advantages:

[0035] (1) This invention proposes an exception definition system with a clear hierarchical structure: by introducing the Flaw keyword, developers can explicitly define exception types and support the inheritance relationship of exception types through Inherits, thereby constructing a clear and extensible exception type tree. This tree-like namespace structure not only effectively avoids exception naming conflicts, but also allows developers to capture and process exceptions at different levels of abstraction, greatly improving the logic and reusability of exception classification.

[0036] (2) The present invention introduces an explicit import and aliasing mechanism for exception types: Through the Import statement, developers can flexibly import defined exception types and support setting aliases or using placeholders for exception types, effectively solving the naming conflict problem that may occur when multiple modules collaborate, and improving the modularity and organization of the code.

[0037] (3) The present invention designs a set of concise and more expressive exception handling syntax structure: Let, Try, Catch, Finally, Throw, Endtry and other core keywords together constitute a complete and syntactically unified exception handling block; in particular, the Let statement supports both single-line and multi-line syntax forms, which can quickly capture and handle a single exception, as well as clearly handle multiple exception branches, thereby greatly reducing the writing of template code.

[0038] (4) The present invention realizes the structured transmission of abnormal parameters: Unlike the existing mechanism where abnormalities can only carry string information, the present invention allows abnormal objects to have built-in structured data. Developers can customize abnormal attributes, thereby transmitting richer context information, which is convenient for the upper layer to accurately locate and recover.

[0039] (5) This invention provides automatic exception propagation and termination semantics: Uncaught exceptions will automatically propagate upwards along the call stack without requiring manual transmission by the developer. At the same time, the Finally statement ensures that the resource cleanup logic will be executed, taking into account both the convenience of development and the reliability of the system.

[0040] In summary, the exception handling mechanism provided by this invention effectively integrates the control of return value mechanisms and the automation advantages of ordinary exception mechanisms through structured exception definitions, flexible import and naming mechanisms, concise and unified syntax, exception objects supporting structured data, and reliable propagation and cleanup strategies, while avoiding the main drawbacks of both. This invention is particularly suitable for medium to large-scale software projects, framework development, and systems with high reliability requirements, significantly reducing the development cost of error handling and improving code quality and team collaboration efficiency. Attached Figure Description

[0041] Figure 1 This is a flowchart illustrating the steps of a novel exception definition and handling method according to the present invention.

[0042] Figure 2 A flowchart illustrating the construction of an exception type tree, as an example of this invention;

[0043] Figure 3 This is a system framework diagram showing the application of the OSE (Rainbow) exception handling mechanism of the present invention to upper-layer applications. Detailed Implementation

[0044] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0045] This invention provides a novel exception definition and processing method, comprising the following steps S1-S4:

[0046] S1. Define exception types using the Flaw keyword.

[0047] Step S1 corresponds to defining the exception. This invention uses the keyword "Flaw" to define the exception type, i.e., the exception category. In one embodiment, the example code for defining the exception type is as follows:

[0048]

[0049] Preferably, step S1 further includes: implementing exception type inheritance through the Inherits keyword to construct a structured exception type tree. That is, for exception classification, the present invention adopts a lightweight exception classification for error classification, uses the keyword Flaw to define exception categories, and exception categories can be combined into a complete exception tree structure, i.e., an exception type tree, or inheritance tree, through Inherits. In other words, the present invention supports the definition of exceptions through the Flaw keyword and supports inheritance.

[0050] like Figure 2 The diagram shows a flowchart of constructing an exception type tree, which is a tree structure composed of multiple exception types. Each exception type in the exception type tree constitutes an exception namespace, such as... Figure 2 In this context, `Network.Http` serves as an exception namespace. Each exception is uniquely identified by a path from the root node to a leaf node, resolving naming conflicts for exception types. It can be understood that through step S1, this invention allows developers to explicitly construct an exception type tree with inheritance relationships using the `Flaw` and `Inherits` keywords. This tree structure starts from the root node `Throwable` and progressively derives exception types at different abstract levels. For example, the basic network exception `Network` can further derive specific application-layer exceptions such as `Http` and `FTP`. Each exception type constitutes an independent exception namespace, effectively avoiding type naming conflicts and supporting fine-grained processing at different levels during capture. The structured type definition described above significantly improves the logical clarity of exception classification and system scalability.

[0051] S2. Import exception types using the Import statement.

[0052] Step S2 imports the defined exception types, i.e., exception namespaces, using the Import statement. In one embodiment, example code for importing exception types using the Import statement is as follows:

[0053]

[0054] Preferably, step S2 further includes: defining aliases and / or placeholders for the imported exception types using the Import statement to better avoid naming conflicts of exception types; wherein, the above definition of placeholders means using placeholders to partially replace the path of the exception type, i.e., the exception namespace.

[0055] In one embodiment, the following is an example code snippet demonstrating how to import an exception type and define an alias using the Import statement:

[0056]

[0057] In one embodiment, the following is an example code snippet showing how to import an exception type and define aliases and placeholders using the Import statement:

[0058]

[0059] S3. Throw exceptions using the Throw keyword.

[0060] Step S3 involves throwing an exception, i.e., throwing an error, using the Throw keyword. In one embodiment, example code for throwing an exception type using the Throw keyword is as follows:

[0061]

[0062] S4. Capture and handle exception types.

[0063] Specifically, in step S4, exception types can be captured and processed in single-line or multi-line form using a Let statement combined with a Catch clause. Specific exception types or multiple exception types can also be captured and processed using a Let statement combined with a Catch clause. In other words, in step S4, exception types can be captured and processed in single-line (single-line syntax) or multi-line (multi-line syntax) form using a Let statement combined with a Catch clause, and it supports capturing and processing specific exception types or multiple exception types. The Catch clause supports wildcards or default capture of all exception types inherited from Throwable.

[0064] The `Let` statement mentioned above corresponds to the `Let` keyword, which is used to accept and handle exceptions. The `Let` keyword supports both single-line and multi-line syntax. In one embodiment, the following is an example code snippet demonstrating how to use a `Let` statement combined with a `Catch` clause to catch and handle a specific exception type in a single-line format:

[0065]

[0066] In one embodiment, the following is an example code snippet showing how to capture and handle multiple exception types (exceptions separated by commas) in a single line using a Let statement combined with a Catch clause:

[0067]

[0068] In one embodiment, the following is an example code snippet showing how to capture and handle all exception types in a single line using a Let statement combined with a Catch clause:

[0069]

[0070] In one embodiment, the following is an example of code that uses Let statements combined with Catch clauses to capture and handle multiple exception types in a multi-line format:

[0071]

[0072] In addition, in step S4, exception types of code blocks or code segments can also be captured and processed using the "Try...Catch...Finally...Endtry" structure. That is, exception types can be captured and processed using the syntax structure formed by combining keywords such as Try, Catch, Finally, and Endtry. Among them, Try supports receiving exception types thrown within the code segment; Catch supports exception type matching, i.e., error matching; Finally supports execution regardless of whether an exception has occurred; and Endtry indicates the end of capturing exceptions within the code segment.

[0073] Preferably, the novel exception definition and handling method of the present invention may further include: uncaught exception types are automatically propagated up the call stack until they are caught or the program terminates; that is, regarding the transitivity of exceptions, for uncaught exceptions and without a `Finally` statement (corresponding to the `Finally` keyword), the execution of the current function will end, and the exception will be propagated upwards layer by layer until it is caught or the program exits. This provides automatic exception propagation and termination semantics, eliminating the need for developers to manually propagate exceptions.

[0074] This invention also provides an exception definition processing system based on the novel exception definition processing method described above, comprising: an exception definition module for defining exception types using the `Flaw` keyword; an exception import module for importing exception types using the `Import` statement; an exception throwing module for throwing exception types using the `Throw` keyword; and an exception capture and processing module for capturing and processing exception types. For details regarding the exception definition processing system of this invention, please refer to the relevant description of the novel exception definition processing method described above, which will not be elaborated upon here.

[0075] The present invention also provides an electronic device comprising a memory and a processor coupled to each other. The memory stores program instructions, and the processor executes the program instructions stored in the memory to implement any of the novel exception definition handling methods described above. In a specific implementation scenario, the electronic device may include, but is not limited to, a microcomputer or a server. Furthermore, the electronic device may also include mobile devices such as laptops and tablets, without limitation.

[0076] Specifically, the processor described above controls itself and its memory to implement any of the novel exception handling methods mentioned above. The processor can also be called a CPU (Central Processing Unit). The processor may be an integrated circuit chip with signal processing capabilities. The processor can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor. Furthermore, the processor can be implemented using integrated circuit chips.

[0077] Furthermore, the present invention also provides a computer-readable storage medium storing program instructions thereon, which, when executed by a processor, implement any of the novel exception definition handling methods described above. The storage medium may include various media capable of storing program instructions, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0078] In summary, this invention aims to provide an efficient and structured exception handling mechanism for the software development field. This mechanism can be named the OSE (Rainbow) exception handling mechanism. It proposes a systematic solution to the core problems exposed in practical applications of the two widely used exception handling methods in the industry: return value-based error code mechanisms and ordinary exception handling mechanisms. The core objective of this invention is to significantly reduce the complexity of error handling during development, improve code readability, maintainability, and overall system robustness, while simultaneously considering development efficiency and runtime performance.

[0079] The aforementioned OSE (Object Sense) is the OSE language, originating from the Codigger platform project and developed under the leadership of Trotter. Its first version was completed and put into platform use in January 2022. As an object-oriented scripting language, it is based on Vimlanguage for object-oriented encapsulation. Its core code is less than a thousand lines, combining highly refined features with excellent performance. It aims to simplify the construction of reliable and efficient software, helping developers quickly bring applications from concept to reality. Furthermore, Rainbow is the version designation of the OSE language; that is, Rainbow is a type of OSE language. Additionally, this invention can also be applied to other versions of the OSE language, or to other types of programming languages ​​besides OSE; no further limitations are imposed here. One of the core features of the OSE (Rainbow) exception handling mechanism corresponding to this invention is that it allows developers to explicitly construct an exception type tree with inheritance relationships using the `Flaw` and `Inherits` keywords. This tree structure starts from the root node `Throwable` and gradually derives exception types at different abstract levels. For example, the basic network exception `Network` can be further derived into specific application-layer exceptions such as `Http` and `FTP`. Each exception type constitutes an independent namespace, effectively avoiding type naming conflicts and supporting fine-grained processing at different levels during capture. This structured type definition significantly improves the logical clarity of exception classification and system scalability.

[0080] The core keywords of the above OSE (Rainbow) exception handling mechanism are shown in Table 1 below:

[0081] Table 1. Explanation of the core keywords corresponding to this invention.

[0082]

[0083] like Figure 3 The diagram shown illustrates the system framework of the OSE (Rainbow) exception handling mechanism of this invention applied to upper-layer applications. Figure 3 This invention explains that the OSE (Rainbow) exception handling mechanism is a core service at the language level. The exception handling syntax in the application code is processed by a dedicated engine in the OSE interpreter. This engine is responsible for managing the metadata of all exception types, matching and dispatching exceptions at runtime, and controlling the lifecycle of exception objects. The engine coordinates the underlying system resources to support these operations, thereby providing a powerful and transparent exception handling infrastructure for upper-layer applications. In other words, the exception definition and processing system of this invention can be integrated into the OSE language interpreter or compiler to form an exception handling subsystem for the OSE language runtime.

[0084] With the rapid development of information technology, the scale and complexity of modern software systems have exploded, placing unprecedentedly high demands on system reliability, robustness, and maintainability. Exception handling, as one of the core mechanisms for ensuring software quality, directly impacts development efficiency, maintenance costs, and ultimately, the user experience. However, looking at current mainstream programming paradigms, their exception handling mechanisms have not undergone paradigm-level innovation for many years, generally suffering from inherent defects such as loose definitions, management difficulties, and cumbersome usage. This forces developers to expend considerable energy in the quagmire of intertwined business logic and error handling, becoming a major bottleneck in improving software development efficiency.

[0085] This invention deeply understands this long-standing industry pain point and creatively proposes a thorough exception handling solution built into OSE (Object Sense), a new object-oriented programming language. This solution is not a simple encapsulation or improvement of existing mechanisms, but rather a native refactoring and deep integration at the syntax and runtime levels of the programming language. The core idea of ​​this invention lies in typed, objectified, and namespaced exceptions. By introducing a series of precisely defined keywords and syntactic structures, a complete, self-consistent, and efficient exception handling ecosystem is constructed.

[0086] Specifically, this invention allows developers to define structured exception types using the `Flaw` keyword, much like defining classes, and establishes a clear exception inheritance hierarchy through the `Inherits` keyword. This makes exception classification scientific and rigorous, and exception information can be richly expressed through object properties. The unique exception namespace mechanism fundamentally solves the persistent problem of global conflicts in exception definitions in large projects. At the exception usage level, the `Let` statement combined with `Catch` clauses captures and handles exception types in single-line or multi-line form, providing an extremely concise yet powerful syntax for exception capture and handling, significantly reducing template code. Furthermore, exception throwing and propagation are entirely managed automatically by the language runtime, achieving complete automation.

[0087] The OSE (Rainbow) exception handling mechanism of this invention covers the entire lifecycle from exception definition (Flaw), import (Importflaw), and throw (Throw) to catch (Let / Try...Catch) and cleanup (Finally). The advantages of this invention are comprehensive and significant: for individual developers, it greatly simplifies daily coding and reduces the coding burden; for development teams, it provides an excellent foundation for modularity and collaboration, avoiding naming conflicts; for the entire software project, it significantly enhances code readability, maintainability, and long-term operational reliability.

[0088] In summary, this invention provides an advanced exception handling system design and implementation method that is deeply integrated into programming languages. It represents a clear technological advancement in the field of exception handling and offers an efficient, elegant, and scalable new path to solve the long-standing error management problem that has plagued the software engineering community. It has extremely high industrial application value and broad market prospects.

[0089] It should be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0090] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A novel method for defining and handling exceptions, characterized in that, Includes the following steps: S1. Define exception types using the Flaw keyword; S2. Import the exception type using the Import statement; S3. Throw the exception type using the Throw keyword; S4. Capture and process the exception type.

2. The novel exception definition and processing method according to claim 1, characterized in that, Step S1 further includes: implementing the inheritance of the exception type through the Inherits keyword to construct a structured exception type tree.

3. The novel exception definition and processing method according to claim 1, characterized in that, Step S2 further includes: defining aliases and / or placeholders for the imported exception type using the Import statement.

4. The novel exception definition and processing method according to claim 1, characterized in that: In step S4, the exception type is captured and processed in single-line or multi-line form by using Let statements in combination with Catch clauses.

5. The novel exception definition and processing method according to claim 4, characterized in that: In step S4, the Let statement combined with the Catch clause is used to capture and process a specific exception type or multiple exception types.

6. The novel exception definition and processing method according to claim 1, characterized in that: In step S4, the exception type of the code block is captured and processed using the "Try...Catch...Finally...Endtry" structure.

7. The novel exception definition and processing method according to claim 1, characterized in that, Also includes: Uncaught exceptions of this type are automatically propagated up the call stack until they are caught or the program terminates.

8. An exception definition processing system based on the novel exception definition processing method according to any one of claims 1-7, characterized in that, include: The exception definition module is used to define exception types using the Flaw keyword; The exception import module is used to import the exception type via the Import statement; An exception throwing module is used to throw the exception type using the Throw keyword; An exception capture and processing module is used to capture and process the exception type.

9. An electronic device comprising a memory and a processor coupled to each other, the memory storing program instructions, characterized in that: The processor is used to execute the program instructions to implement the novel exception definition handling method as described in any one of claims 1-7.

10. A computer-readable storage medium having program instructions stored thereon, characterized in that: When the program instructions are executed by the processor, they implement the novel exception definition and handling method as described in any one of claims 1-7.