Code processing method and device of distributed system and electronic equipment

By scanning and deduplicating error code information in a distributed system and generating enumerated data to replace the error codes, the problems of error code duplication and semantic conflicts in distributed systems are solved, improving the efficiency and accuracy of error code processing and enhancing the stability and maintainability of the system.

CN121501291APending Publication Date: 2026-02-10INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511723513.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-21
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

In distributed systems, error codes are defined independently by different development teams for each system node, leading to duplicate error codes and semantic conflicts. This increases system complexity and maintenance difficulty, and reduces the efficiency and accuracy of error code processing.

Method used

By acquiring the code files of the distributed system, scanning and deduplicating error code information, generating enumeration class data, replacing and modifying the error codes in the initial code, ensuring the uniqueness and consistency of each error code in the system, and using the enumeration class data to modify and provide feedback on error codes.

Benefits of technology

This approach improves the efficiency and accuracy of error code handling, reduces the risk of system failure, and enhances system stability and maintainability without modifying the code files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121501291A_ABST
    Figure CN121501291A_ABST
Patent Text Reader

Abstract

The invention discloses a code processing method and device of a distributed system and electronic equipment. Relates to the distributed field, and the method comprises the following steps: obtaining a code file of a system node in a distributed system, and scanning the code file to obtain an initial error code information set in the code file; performing duplicate removal operation on the initial error code information set to obtain a target error code information set; sequentially generating enumeration class data of each piece of target error code information to obtain N pieces of enumeration class data; and in the code file, modifying the initial code associated with the corresponding target error code information according to each enumeration type data to obtain an updated code file. According to the method and the device, the problem that the efficiency and the accuracy rate of processing the error codes in the distributed system are low in the related technology is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of distributed systems, and more specifically, to a code processing method, apparatus, and electronic device for a distributed system. Background Technology

[0002] In large-scale distributed systems, error codes are a crucial fault diagnosis and reporting mechanism. An error code can be a unique, identifiable number or string used to represent a specific error or abnormal condition encountered during system operation. Error codes can be further categorized into various types, such as system-level errors, application-level errors, and network errors, with each type potentially containing hundreds or even thousands of specific error codes. Error codes can quickly indicate the type and cause of an error, helping development and operations personnel to rapidly locate and resolve problems.

[0003] Currently, in distributed systems, because system nodes may be developed by multiple teams, the definition and use of error codes lack unified planning. Each team may define error codes independently, leading to duplication and semantic conflicts. For example, different teams may use the same error code for similar errors, even though the actual handling and context of these errors may be completely different. This conflict not only increases the complexity of the system but may also cause confusion in error handling, reducing the system's stability and maintainability.

[0004] Furthermore, because error codes are scattered throughout the system code, maintaining them becomes extremely difficult. Every time an error code is added or modified, developers need to manually write code, update documentation and configuration files, which not only reduces development efficiency but also increases the risk of errors.

[0005] There is currently no effective solution to the problem of low efficiency and accuracy in processing error codes in distributed systems in related technologies. Summary of the Invention

[0006] The main objective of this application is to provide a code processing method, apparatus, and electronic device for distributed systems, in order to solve the problem of low efficiency and accuracy in processing error codes in distributed systems in related technologies.

[0007] To achieve the above objectives, according to one aspect of this application, a code processing method for a distributed system is provided. The method includes: obtaining the code file of a system node in the distributed system, and scanning the code file to obtain an initial error code information set, wherein the initial error code information set includes M initial error code information entries, each entry including an error code identifier and an error code comment, where M is a positive integer; performing a deduplication operation on the initial error code information set to obtain a target error code information set, wherein the target error code information set includes N target error code information entries, where N is a positive integer and M is greater than N; sequentially generating enumeration class data for each target error code information entry, resulting in N enumeration class data entries; and modifying the initial code associated with the corresponding target error code information in the code file according to each enumeration class data entry, resulting in an updated code file.

[0008] Optionally, performing a deduplication operation on the initial error code information set to obtain the target error code information set includes: determining whether there are initial error code information pairs with the same error code identifier in the initial error code information set; if there are no initial error code information pairs with the same error code identifier, determining the initial error code information set as the target error code information set; if there are initial error code information pairs with the same error code identifier, determining whether the error code comments of the initial error code information pairs are the same; if the error code comments are the same, deleting any one of the initial error code information pairs from the initial error code information set; if the error code comments are different, modifying the error code identifier of any one of the initial error code information pairs, and modifying the error code identifier of the initial error code information in the code file.

[0009] Optionally, the initial code associated with the corresponding target error code information is modified according to each enumeration class data to obtain the updated code file, including: for each target error code information, identifying the target code containing the target error code information from the initial code, and replacing the target error code in the target code with the enumeration class data to obtain the updated target code; performing consistency processing on the updated target code according to the code attributes of the initial code to obtain the replacement code; and replacing the target code in the initial code with the replacement code to obtain the updated code file.

[0010] Optionally, the method further includes: upon receiving a modification instruction, obtaining enumeration class data of the target error code information indicated by the modification instruction, and modifying the enumeration class data, wherein the modification instruction is used to indicate modification of any target error code information; upon receiving an add instruction, generating new enumeration class data of the new error code information carried by the add instruction, and storing the new enumeration class data in a target storage area, wherein the target storage area is used to store N enumeration class data corresponding to the code file, and the add instruction is used to indicate adding new error code information.

[0011] Optionally, the method further includes: upon detecting that an error code usage code in any target node of the distributed system has been triggered, determining the enumeration class data associated with the error code usage code, and obtaining the error code annotation in the enumeration class data; determining whether there is custom information for the error code annotation in the target node; if there is custom information in the target node, determining the custom information as the error information of the target node; if there is no custom information in the target node, determining whether there is descriptive information for the error code annotation; if there is descriptive information for the error code annotation, determining the descriptive information as the error information of the target node; if there is no descriptive information for the error code annotation, determining the error code annotation as the error information of the target node; and feeding back the error information to the client that triggered the error code usage code.

[0012] Optionally, sending error information back to the client that triggered the error code includes: obtaining context information from the configuration file of the code file based on the error information, wherein the context information is the context information of the error code corresponding to the error information; adding the context information to the error information to obtain the updated error information; and sending the updated error information back to the client.

[0013] Optionally, sending error information back to the client that triggered the error code includes: sending the error information to a target queue and determining whether the number of error information in the target queue is greater than or equal to a preset number; if the number of error information is greater than or equal to the preset number, sending back all error information in the target queue; if the number of error information is less than the preset number, determining whether the information feedback time has been reached; if the information feedback time has been reached, sending back all error information in the target queue; if the information feedback time has not been reached, performing a waiting operation until the information feedback time is reached or the number of error information equals the preset number.

[0014] To achieve the above objectives, according to another aspect of this application, a code processing apparatus for a distributed system is provided. The apparatus includes: an acquisition unit, configured to acquire code files of system nodes in the distributed system and scan the code files to obtain an initial error code information set in the code files, wherein the initial error code information set includes M initial error code information items, each initial error code information item including an error code identifier and an error code comment, and M is a positive integer; a processing unit, configured to perform a deduplication operation on the initial error code information set to obtain a target error code information set, wherein the target error code information set includes N target error code information items, N is a positive integer, and M is greater than N; a first generation unit, configured to sequentially generate enumeration class data for each target error code information item, obtaining N enumeration class data items; and a first modification unit, configured to modify the initial code associated with the corresponding target error code information in the code file according to each enumeration class data item, to obtain an updated code file.

[0015] Optionally, the processing unit includes: a first judgment module, used to judge whether there is an initial error code information pair with the same error code identifier in the initial error code information set; a determination module, used to determine the initial error code information set as the target error code information set when there is no initial error code information pair with the same error code identifier; a second judgment module, used to judge whether the error code comments of the initial error code information pairs are the same when there are initial error code information pairs with the same error code identifier; a deletion module, used to delete any one of the initial error code information in the initial error code information pair from the initial error code information set when the error code comments are the same; and a modification module, used to modify the error code identifier of any one of the initial error code information in the initial error code information pair when the error code comments are different, and to modify the error code identifier of the initial error code information in the code file.

[0016] Optionally, the first modification unit includes: an identification module, used to identify target code containing target error code information from the initial code for each target error code information, and replace the target error code in the target code with enumerated class data to obtain the updated target code; a processing module, used to perform consistency processing on the updated target code according to the code attributes of the initial code to obtain the replacement code; and a replacement module, used to replace the target code in the initial code with the replacement code to obtain the updated code file.

[0017] Optionally, the device further includes: a second modification unit, configured to, upon receiving a modification instruction, acquire enumeration class data of the target error code information indicated by the modification instruction, and modify the enumeration class data, wherein the modification instruction is used to instruct modification of any target error code information; and a second generation unit, configured to, upon receiving an add instruction, generate new enumeration class data of the newly added error code information carried by the add instruction, and store the new enumeration class data in a target storage area, wherein the target storage area is used to store N enumeration class data corresponding to the code file, and the add instruction is used to instruct the addition of new error code information.

[0018] Optionally, the device further includes: a first determining unit, configured to determine the enumeration class data associated with the error code usage code and obtain the error code annotation in the enumeration class data when the error code usage code in any target node of the distributed system is triggered; a first judging unit, configured to judge whether there is custom information of error code annotation in the target node; a second determining unit, configured to determine the custom information as the error information of the target node if the custom information exists in the target node; a second judging unit, configured to judge whether there is descriptive information of error code annotation if the custom information does not exist in the target node; a third determining unit, configured to determine the descriptive information as the error information of the target node if the descriptive information of error code annotation exists; a fourth determining unit, configured to determine the error code annotation as the error information of the target node if the descriptive information of error code annotation does not exist; and a feedback unit, configured to feed back the error information to the client that triggered the error code usage code.

[0019] Optionally, the fourth determining unit includes: an acquisition module, used to acquire context information from the configuration file of the code file according to the error information, wherein the context information is the context information of the error code corresponding to the error information; and an addition module, used to add the context information to the error information to obtain the updated error information, and to feed back the updated error information to the client.

[0020] Optionally, the fourth determining unit includes: a third judging module, used to send error information to the target queue and judge whether the number of error information in the target queue is greater than or equal to a preset number; a first feedback module, used to provide feedback on all error information in the target queue when the number of error information is greater than or equal to the preset number; a fourth judging module, used to judge whether the information feedback time has been reached when the number of error information is less than the preset number; a second feedback module, used to provide feedback on all error information in the target queue when the information feedback time has been reached; and an execution module, used to perform a waiting operation until the information feedback time is reached or the number of error information is equal to the preset number when the information feedback time has not been reached.

[0021] To achieve the above objectives, according to another aspect of this application, an electronic device is provided, comprising a memory storing an executable program; and a processor for running the program, wherein the program executes the code processing method of the distributed system described above during runtime.

[0022] To achieve the above objectives, according to another aspect of this application, a computer program product is provided, including computer instructions that, when executed by a processor, implement the steps of the code processing method for the distributed system described above.

[0023] In this embodiment, the code files of system nodes in the distributed system are obtained and scanned to obtain an initial set of error code information. This initial set includes M initial error code information entries, each containing an error code identifier and an error code comment, where M is a positive integer. The initial set is then deduplicated to obtain a target set of error code information, containing N target error code information entries, where N is a positive integer and M is greater than N. Enumeration class data for each target error code information entry is generated sequentially, resulting in N enumeration class data entries. Finally, in the code files, the initial code associated with each target error code information entry is modified according to the enumeration class data entries. The updated code file is obtained by deduplicating error codes in the code file and modifying the initial code associated with each target error code information using an enumeration class of the target error code information. This changes the error codes in the code file to enumeration classes, and then modifies the error codes in the code file by modifying the enumeration classes. This achieves the goal of only modifying the error code information in the enumeration class file when error code processing is required, without modifying the code file itself. This improves the efficiency and accuracy of error code processing in distributed systems, thus solving the technical problem of low efficiency and accuracy in error code processing in distributed systems in related technologies. Attached Figure Description

[0024] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0025] Figure 1 A hardware structure block diagram of a computer terminal for implementing a code processing method for a distributed system is shown.

[0026] Figure 2 This is a flowchart of a code processing method for a distributed system according to Embodiment 1 of this application;

[0027] Figure 3 This is a schematic diagram of a code processing device for a distributed system according to Embodiment 2 of this application;

[0028] Figure 4 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0029] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0030] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0032] It should be noted that the code processing methods, apparatuses, and electronic devices for distributed systems as defined in this disclosure can be used in the field of distributed systems, or in any field other than the field of distributed systems. The application fields of the code processing methods, apparatuses, and electronic devices for distributed systems as defined in this disclosure are not limited.

[0033] It should be noted that all information, user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, and displayed data) used in this application are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of related data all comply with the relevant laws, regulations, and standards of the relevant regions, have taken necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entry points for users to choose to authorize or refuse use. If the user chooses to refuse, the process will proceed to the expert decision-making process. For example, this system has an interface with relevant users or organizations. Before obtaining relevant information, a request to obtain the information needs to be sent to the aforementioned user or organization through the interface. After receiving consent from the aforementioned user or organization, the relevant information is obtained. Users can view the purpose of data use in real time through the authorization interface and have the right to withdraw authorization or delete data at any time. After the authorization is withdrawn, the system will terminate the relevant data processing within 24 hours.

[0034] The embodiments or examples disclosed herein are not exhaustive, but merely illustrative of some embodiments or examples, and are not intended to limit the scope of protection of this disclosure. Unless otherwise specified, each step in a particular embodiment or example can be implemented as an independent embodiment, and the steps can be arbitrarily combined. For example, a solution after removing some steps in a particular embodiment or example can also be implemented as an independent embodiment, and the order of the steps in a particular embodiment or example can be arbitrarily interchanged. Furthermore, optional methods or examples in a particular embodiment or example can be arbitrarily combined; moreover, embodiments or examples can be arbitrarily combined. For example, some or all steps of different embodiments or examples can be arbitrarily combined, and a particular embodiment or example can be arbitrarily combined with optional methods or examples of other embodiments or examples.

[0035] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:

[0036] A distributed system is a system composed of multiple computers connected via a network to collaboratively complete one or more tasks. In this application, a node refers to each server or service component within the distributed system.

[0037] Enumeration class data: In object-oriented programming languages ​​such as Java, an enumeration class (enum) is a special class used to define a fixed set of constants. In this application, enumeration class data is used to encapsulate error code information for safer and more convenient use in the code.

[0038] Example 1

[0039] According to an embodiment of this application, an embodiment of a code processing method for a distributed system is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0040] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal for implementing a code processing method in a distributed system is shown. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, processing devices such as microprocessors or programmable logic devices), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface, a universal serial bus port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0041] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0042] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the code processing method of the distributed system in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the code processing method of the distributed system described above. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0043] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0044] The display may be, for example, a touchscreen LCD display that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).

[0045] Under the aforementioned operating environment, this application provides the following: Figure 2 The code processing method of the distributed system is shown. Figure 2 This is a flowchart of a code processing method for a distributed system according to Embodiment 1 of this application, as shown below. Figure 2 As shown, the method includes:

[0046] Step S201: Obtain the code file of the system node in the distributed system, and scan the code file to obtain the initial error code information set in the code file. The initial error code information set includes M initial error code information, which includes error code identifier and error code comment, where M is a positive integer.

[0047] It should be noted that the execution entity in this embodiment can be a code processing system of a distributed system. This system can modify the code related to error codes in the existing distributed system code, so that when the modified system code processes error codes, such as adding or modifying them, it can adjust only the enumeration class data of the error codes without adjusting the code, thereby improving the processing efficiency and accuracy of processing the error code part of the code.

[0048] It should be noted that the code files of system nodes refer to the source code files distributed across various nodes. These files contain the system's business logic and error handling mechanisms, and may include error codes. The initial set of error code information can be a set of error code information obtained by scanning the code files. Each piece of information in the set contains an identifier and a comment for the error code. The identifier is the code of the error code, and the comment describes the meaning of the error code.

[0049] Optionally, when adjusting error codes in code files, it's first necessary to traverse all system nodes in the distributed system, automatically collecting and scanning the code files of each node, such as Java source code and configuration files, to identify error code information. Error code information can take the form of comments, specific class or method names, or direct code. Parsing tools can be used to parse the code files according to preset regular expressions or syntax structures, extracting error code identifiers and corresponding comments. These extracted error code identifiers and corresponding comments are then collected into an initial error code information set for further processing.

[0050] Step S202: Perform a deduplication operation on the initial error code information set to obtain the target error code information set, wherein the target error code information set includes N target error code information, where N is a positive integer and M is greater than N.

[0051] Optionally, after collecting the initial error code information, the system will perform deduplication on the initial error code information set. This deduplication operation is based on the uniqueness of the error code identifier, ensuring that each error code appears only once in the set. If duplicate error code identifiers exist, the system will process the duplicate identifiers and the corresponding code portion within the code, thereby ensuring the consistency and uniqueness of error codes within the code. This deduplication operation avoids the repeated definition and use of error codes, ensuring that each error code is unique within the system, reducing the risk of system failures due to error code conflicts, and improving system stability and maintainability.

[0052] Step S203: Generate enumeration class data for each target error code information in sequence to obtain N enumeration class data.

[0053] Optionally, based on the deduplicated set of target error code information, the system will automatically generate enumeration class data corresponding to each target error code. Each target error code will be encapsulated within an instance of the enumeration class data, which follows preset naming rules and structure. In addition to the error code identifier, the enumeration class data also contains a description of the error code and possible solutions. That is, when the code needs to use an error code, the detailed description of the error code can be directly accessed through the enumeration class data set in the code, and the error code identifier and meaning will be returned based on the description, thus eliminating the need to rely on comments or consulting documentation.

[0054] Therefore, using enumeration class data to represent error codes not only makes the use of error codes more accurate and consistent, but also improves the readability and maintainability of the code. At the same time, the use of enumeration class data can prevent error codes from being misused or abused, and the detailed descriptions and solutions in the enumeration class data also improve the efficiency of development and operation personnel in solving problems.

[0055] For example, for each piece of information in the target error code information set, such as "ERR_0001", the system will generate an enumeration class data instance, as shown below:

[0056] The tool automatically generates an AccountServiceErrorCodeEnum enumeration class, which contains enumeration class data instances of the ACCOUNT_NOT_FOUND error code, for example:

[0057] Java public enum AccountServiceErrorCodeEnum {

[0058] ACCOUNT_NOT_FOUND("0001", "Account not found");

[0059] / / Other error codes;

[0060] };

[0061] Here, ACCOUNT_NOT_FOUND("0001", "account not found") is an enumeration class of error code 0001. Thus, by calling the enumeration class data ACCOUNT_NOT_FOUND in the code, the error code is determined to be 0001 and the error reason is "account not found".

[0062] Step S204: In the code file, modify the initial code associated with the corresponding target error code information according to each enumeration class data to obtain the updated code file.

[0063] Optionally, after determining the enumeration class data for each target error code, all code files can be traversed. Based on the generated enumeration class data, all initial code related to the target error code information can be modified, thereby replacing the original error code identifier with a call to the enumeration class data. This ensures that when an error code in the code is triggered, the error code identifier is not triggered; instead, the enumeration class data is called, and the error code and description information corresponding to this triggering operation are determined based on the enumeration class data. This ensures that there are no anomalies in the error code call, and that the enumeration class data can be modified directly without modifying the code, thus guaranteeing the accuracy of the code and the consistency and accuracy of the error codes.

[0064] For example, in the code, there might be a code snippet that calls the error code: Error Code 1: EC001, "User authentication failed". Calling error code 1 will send the message "Error Code 1: EC001, "User authentication failed" to the user. However, since error code 1 may be called in multiple places within the system code, modifications to error code 1 will need to be made multiple times, potentially leading to omissions. Therefore, the enumeration class data UserAuthenticationFailed for error code 1 can be generated, representing error code EC001, "User authentication failed". The enumeration class data and the corresponding error code are recorded in the record table of the enumeration class data. At this time, error code 1 in the code snippet: EC001, "User authentication failed" can be modified to UserAuthenticationFailed. Now, if the call to error code 1 occurs again, the error code corresponding to the enumeration class data UserAuthenticationFailed will be determined from the record table by calling the enumeration class data, which is EC001, "User authentication failed", and this will be fed back. At this time, if it is necessary to modify error code 1, the error code content under UserAuthenticationFailed in the record table can be modified directly, thereby ensuring the accuracy of calling error code 1 in the code without modifying the code content, achieving the technical effect of improving the accuracy and efficiency of error code processing.

[0065] The code processing method for a distributed system provided in this application involves obtaining the code files of system nodes in the distributed system and scanning the code files to obtain an initial set of error code information. This initial set of error code information includes M initial error code information entries, each containing an error code identifier and an error code comment, where M is a positive integer. The initial set of error code information is then deduplicated to obtain a target set of error code information, which includes N target error code information entries, where N is a positive integer and M is greater than N. Enumeration class data for each target error code information entry is generated sequentially, resulting in N enumeration class data entries. Finally, in the code file, the initial code information entry associated with each target error code entry is processed according to the enumeration class data. The method involves modifying the code to obtain an updated code file. This is achieved by deduplicating the error codes in the code file and then modifying the initial code associated with each target error code using enumeration data for each target error code. This transforms the error codes in the code file into enumeration data, and by modifying the enumeration data, the error codes in the code file are modified. This achieves the goal of improving the efficiency and accuracy of error code processing in distributed systems by only modifying the error code information in the enumeration file, without needing to modify the code file itself. This solves the technical problem of low efficiency and accuracy in error code processing in distributed systems in related technologies.

[0066] To ensure the accuracy of the deduplication operation, optionally, in the code processing method of the distributed system provided in this application embodiment, performing a deduplication operation on the initial error code information set to obtain the target error code information set includes: determining whether there are initial error code information pairs with the same error code identifier in the initial error code information set; if there are no initial error code information pairs with the same error code identifier, determining the initial error code information set as the target error code information set; if there are initial error code information pairs with the same error code identifier, determining whether the error code comments of the initial error code information pairs are the same; if the error code comments are the same, deleting any one of the initial error code information in the initial error code information pair from the initial error code information set; if the error code comments are different, modifying the error code identifier of any one of the initial error code information in the initial error code information pair, and modifying the error code identifier of the initial error code information in the code file.

[0067] Optionally, during the deduplication operation, a hash table or red-black tree can be used to store all error code identifiers. For each newly scanned error code, the data structure is searched to determine if the error code identifier already exists in the set. If it does, it is considered a potential duplicate and compared with existing error code information to form an initial error code pair.

[0068] If no duplicate error code identifiers are found after traversing the entire initial error code information set, no additional data processing is required, and the current initial error code information set can be directly used as the target error code information set for subsequent steps.

[0069] If the system finds a pair of information with the same error code identifier, it will automatically extract the error code comments of the two pieces of information and compare the text. If the comments are completely identical, it means that the two error codes have the same semantics and purpose, that is, the two initial error code information are completely identical. Therefore, one of the initial error code information can be deleted.

[0070] When comments are different, it indicates that there are initial error code information pairs with the same error code identifier but different comments. In this case, it indicates that the error code identifier is incorrectly set. At this time, it is necessary to modify the error code identifier of one of the initial error code information so that the error code identifier is different from the error code identifier of any other initial error code information. At the same time, it is also necessary to modify the error code identifier of the initial error code information in the code synchronously to ensure the accuracy of the subsequent processing flow of the code file.

[0071] This embodiment ensures the accuracy and uniqueness of the initial error code information by identifying and processing duplicate information in the initial error code information set before processing the code file, thereby ensuring the accuracy of subsequent processing of the code file.

[0072] To ensure the accuracy of the updated code file, optionally, in the code processing method of the distributed system provided in this application embodiment, modifying the initial code associated with the corresponding target error code information according to each enumeration class data to obtain the updated code file includes: for each target error code information, identifying the target code containing the target error code information from the initial code, and replacing the target error code in the target code with the enumeration class data to obtain the updated target code; performing consistency processing on the updated target code according to the code attributes of the initial code to obtain the replacement code; and replacing the target code in the initial code with the replacement code to obtain the updated code file.

[0073] Optionally, after obtaining the enumeration class data, the error code information in the code needs to be updated. First, identify all code segments containing the target error code information from the initial code, i.e., the target code. For example, if the target error code information indicates a communication timeout (0002, COMM_TIMEOUT), then all places in the code that involve this error code will become the target code, which may appear in the exception handling of network requests or as part of the function return value.

[0074] After identifying the target code, it needs to be replaced using enumeration class data. The enumeration class data contains updated error code information and descriptions; for example, replacing the error code (0002, COMM_TIMEOUT) with the enumeration class data "ErrorXxxxxx". The replacement process involves extracting the error code and description information from the target code and then replacing it with the corresponding data from the enumeration class data. Consistency handling may include adjusting indentation, formatting strings, handling variable naming, and ensuring that all code snippets interacting with the enumeration class data follow the same design patterns, such as using dotted access or method calls instead of direct indexes.

[0075] Furthermore, after obtaining the updated and replaced target code, it needs to undergo consistency processing to ensure that the replaced code maintains consistency in style and structure with the rest of the code, avoiding the introduction of new errors or non-standard code. For example, if the coding style specifies that all function names should use camelCase, then function calls in the replaced target code must also follow this rule.

[0076] After consistency processing, the target code in the initial code can be replaced with replacement code to obtain the updated code file, thereby ensuring the accuracy and usability of the updated code file, and enabling the updated code file to obtain error code information by calling enumeration class data.

[0077] This embodiment improves code readability and maintainability by replacing error code information in the code file with enumeration class data. Each enumeration class data represents a specific error code and its description, making the use of error codes more standardized and accurate.

[0078] To ensure the accuracy of the modified error code information, optionally, in the code processing method of the distributed system provided in this application embodiment, the method further includes: upon receiving a modification instruction, obtaining enumeration class data of the target error code information indicated by the modification instruction, and modifying the enumeration class data, wherein the modification instruction is used to indicate the modification of any target error code information; upon receiving an add instruction, generating new enumeration class data of the newly added error code information carried by the add instruction, and storing the new enumeration class data in a target storage area, wherein the target storage area is used to store N enumeration class data corresponding to the code file, and the add instruction is used to indicate the addition of new error code information.

[0079] It should be noted that modification commands can be user-initiated operations that instruct the system to change specific error code information, including but not limited to modifying the error code identifier and error code comments. Add commands can be user-initiated operations that instruct the system to add new error code information and its corresponding enumeration class data.

[0080] Optionally, upon receiving a modification instruction, the system retrieves the identifier and error code comment of the target error code information carried by the instruction. This requires first locating the enumeration class data corresponding to the error code information, and then modifying the error code information in the enumeration class data according to the modification instruction, such as changing the error comment to the latest information indicated in the instruction. After modification, the system does not need to modify the code file. When calling the modified error code information, the updated error code information can be directly obtained through the enumeration class data, thereby improving the convenience and efficiency of modifying error code information.

[0081] Optionally, upon receiving an add instruction, the instruction includes a completely new error code identifier, error code comment, and some additional attributes (such as error level, error category, etc.). The system first creates a new enumeration class data based on this information and adds it to the record table or storage area that stores other enumeration class data, thus completing the process of adding new error code information to the enumeration class data. When the code file calls this enumeration class data, it can retrieve the error code information under that enumeration class data from the record table or storage area for feedback, thereby completing the error code information feedback process.

[0082] It should be noted that code examples related to the newly added enumeration class data (such as code for throwing and catching errors) will also be generated for developers to refer to and use, ensuring that the newly added enumeration class data can be accurately applied in the project.

[0083] This embodiment modifies error code information by modifying enumeration data, thereby improving the convenience and efficiency of modifying error code information.

[0084] To ensure the accuracy of the error information, optionally, in the code processing method for a distributed system provided in this application embodiment, the method further includes: when an error code usage code in any target node of the distributed system is detected to be triggered, determining the enumeration class data associated with the error code usage code, and obtaining the error code annotation in the enumeration class data; determining whether there is custom information of the error code annotation in the target node; if there is custom information in the target node, determining the custom information as the error information of the target node; if there is no custom information in the target node, determining whether there is descriptive information of the error code annotation; if there is descriptive information of the error code annotation, determining the descriptive information as the error information of the target node; if there is no descriptive information of the error code annotation, determining the error code annotation as the error information of the target node; and feeding back the error information to the client that triggered the error code usage code.

[0085] Optionally, when an error code is triggered by code in a target node, the system first determines the specific code location that triggered the error code by tracing the code call stack or error log. Next, the system searches for the corresponding enumeration class data based on the error code identifier in the code. That is, it can start from the error code identifier and retrieve the error code comments stored in the enumeration class data to determine the enumeration class data associated with the error code and obtain the error code comments from the enumeration class data.

[0086] Optionally, after obtaining the error code annotations from the enumeration class data, the system will further check whether the target node has custom information for the error code annotation. If custom information exists, it can be identified as the error information of the target node and fed back to the client, so that the client can better determine the content of the error code annotation without using the preset content in the error code annotation, thereby improving the client's error code understanding and recognition efficiency.

[0087] Optionally, if the target node does not have custom information set, the system will continue to check if descriptive information exists in the enumeration class data. The descriptive information can exist as multi-line text or additional fields, providing detailed guidance on the cause of the error and suggested solutions. That is, even without custom information, the descriptive information in the enumeration class data can provide more clues and suggestions about the error, assisting in problem-solving.

[0088] Optionally, when the error code information has no custom information or description information, the system will use the error code comments in the enumeration class data as the error information by default, ensuring that at least a basic error description can be fed back to the client. This ensures that even with limited information coverage, the system can still provide the most basic error description and maintain its basic feedback capability.

[0089] Optionally, regardless of whether the error message originates from custom information, descriptive information, or the original error code comment, once determined, the error message can be encoded in a structured format and sent to the client via a network transmission protocol, thereby completing the error message feedback operation.

[0090] This embodiment achieves the technical effect of improving the efficiency of the client in understanding and analyzing error information by selecting multiple error message feedback methods.

[0091] To ensure that the client can recognize the error information, optionally, in the code processing method of the distributed system provided in this application embodiment, feeding back the error information to the client that triggers the error code includes: obtaining context information from the configuration file of the code file according to the error information, wherein the context information is the context information of the error code corresponding to the error information; adding the context information to the error information to obtain the updated error information, and feeding back the updated error information to the client.

[0092] Optionally, when the error code is triggered on the target node, the error message can be retrieved by querying the configuration file associated with the target node's code file based on the error code identifier contained in the error message. The configuration file stores detailed error code context information, including environmental parameters at the time of the error, the code block or module to which the error belongs, and possible triggering conditions. By parsing the configuration file, the acquisition module can obtain contextual information directly related to the error code, such as "the error occurred during the account balance check," thus increasing the dimensions of the error information, making the error description richer, and helping to accurately identify and locate the source of the error.

[0093] Optionally, the collected context information also needs to be formatted and encoded to combine with the original error information to form a more informative updated error message. For example, the original error message might be "Insufficient account balance (error code: INSUFFICIENT_FUNDS)". After obtaining the context information "The error occurred during the account balance check", the updated error message becomes: "Insufficient account balance (error code: INSUFFICIENT_FUNDS), the error occurred during the account balance check, account ID: 123456, transaction amount: 10,000 yuan."

[0094] Optionally, after receiving the updated error information, the updated error information can be sent to the client to complete the error information feedback operation, while increasing the amount of information contained in the error information and improving the client's efficiency in analyzing the error information.

[0095] This embodiment achieves the technical effect of increasing the amount of information contained in error messages and improving the efficiency of client analysis of error messages by adding contextual information to the error messages.

[0096] To improve the transmission efficiency of error information, optionally, in the code processing method of the distributed system provided in this application embodiment, feeding back error information to the client that triggers the error code usage code includes: sending the error information to a target queue and determining whether the number of error information in the target queue is greater than or equal to a preset number; if the number of error information is greater than or equal to the preset number, feeding back all error information in the target queue; if the number of error information is less than the preset number, determining whether the information feedback time has been reached; if the information feedback time has been reached, feeding back all error information in the target queue; if the information feedback time has not been reached, performing a waiting operation until the information feedback time is reached or the number of error information is equal to the preset number.

[0097] Optionally, to conserve network resources when transmitting error messages, multiple error messages can be sent simultaneously or periodically to avoid continuously consuming network resources by sending them immediately upon their occurrence. Therefore, after generating error messages, they can be encapsulated and sent to a target queue within the system. After the queue receives the error messages, the system checks whether the total number of error messages in the queue has reached a preset threshold, i.e., a preset number.

[0098] Optionally, when the number of error messages in the target queue reaches or exceeds a preset number, the system will trigger a batch feedback operation. The error message processing module will package all error messages in the queue, which can be encapsulated using a structured data format to ensure data integrity and readability. Then, the encapsulated error messages will be transmitted over the network to the client that triggered the error code, thus completing the error message transmission operation.

[0099] Optionally, if the number of error messages in the target queue has not yet reached the preset number, the system will further determine whether the current time has reached the system's preset information feedback time, such as "every 5 minutes" or "1 a.m. every day", so as to ensure that even if the number of error messages is less than the preset threshold, the system can still provide information feedback on a regular basis, avoiding delays or omissions of important error messages.

[0100] Optionally, if the current time has not reached the information feedback moment, and the number of error messages in the target queue is insufficient to trigger a batch feedback operation, the system will remain in a waiting state. This waiting can be achieved through sleep or low-power mode until the next information feedback moment arrives, or until the number of error messages in the target queue increases to a preset number. During the waiting period, the system continuously monitors the changes in the number of error messages in the queue and the progress of time. Once either feedback condition is met, the system immediately executes the error message feedback operation, thereby saving resources while maintaining a high degree of sensitivity and responsiveness to error messages.

[0101] This embodiment improves the flexibility of error message feedback by setting a target queue and determining the error message sending time by setting a preset number and information feedback time. It also reduces system resource consumption by optimizing network transmission strategy, while ensuring that critical error information can be transmitted to the client in a timely and accurate manner.

[0102] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0103] Example 2

[0104] This application also provides a code processing apparatus for a distributed system. It should be noted that the code processing apparatus for a distributed system in this application can be used to execute the code processing method for a distributed system provided in the above embodiments. The code processing apparatus for a distributed system provided in this application will be described below.

[0105] According to an embodiment of this application, an apparatus for implementing the code processing method of the above-described distributed system is also provided. Figure 3 This is a schematic diagram of a code processing device for a distributed system according to Embodiment 2 of this application, as shown below. Figure 3 As shown, the device includes:

[0106] The acquisition unit 31 is used to acquire the code file of the system node in the distributed system and scan the code file to obtain the initial error code information set in the code file. The initial error code information set includes M initial error code information, which includes error code identifier and error code comment, where M is a positive integer.

[0107] Processing unit 32 is used to perform deduplication on the initial error code information set to obtain the target error code information set, wherein the target error code information set includes N target error code information, where N is a positive integer and M is greater than N.

[0108] The first generation unit 33 is used to sequentially generate enumeration class data for each target error code information, resulting in N enumeration class data.

[0109] The first modification unit 34 is used to modify the initial code associated with the corresponding target error code information in the code file according to each enumeration class data, so as to obtain the updated code file.

[0110] The code processing apparatus for a distributed system provided in this application embodiment acquires the code file of the system node in the distributed system through the acquisition unit 31, and scans the code file to obtain an initial error code information set in the code file. The initial error code information set includes M initial error code information entries, each containing an error code identifier and an error code comment, where M is a positive integer. The processing unit 32 performs a deduplication operation on the initial error code information set to obtain a target error code information set, which includes N target error code information entries, where N is a positive integer and M is greater than N. The first generation unit 33 sequentially generates enumeration class data for each target error code information entry, obtaining N enumeration class data entries. The first modification unit 34 modifies the code file according to each enumeration class data entry. The initial code associated with the corresponding target error code information is modified to obtain an updated code file. By deduplicating the error codes in the code file, the initial code associated with each target error code information is modified using an enumeration class for each target error code information. This changes the error codes in the code file to enumeration classes. By modifying the enumeration classes, the error codes in the code file are modified. This achieves the goal of only needing to modify the error code information in the enumeration class file when error code processing is required, without needing to modify the code file. This improves the efficiency and accuracy of error code processing in distributed systems, thus solving the technical problem of low efficiency and accuracy in error code processing in distributed systems in related technologies.

[0111] Optionally, in the code processing apparatus of the distributed system provided in this application embodiment, the processing unit 32 includes: a first judgment module, used to judge whether there is an initial error code information pair with the same error code identifier in the initial error code information set; a determination module, used to determine the initial error code information set as the target error code information set when there is no initial error code information pair with the same error code identifier; a second judgment module, used to judge whether the error code comments of the initial error code information pair are the same when there is an initial error code information pair with the same error code identifier; a deletion module, used to delete any one of the initial error code information in the initial error code information pair from the initial error code information set when the error code comments are the same; and a modification module, used to modify the error code identifier of any one of the initial error code information in the initial error code information pair when the error code comments are different, and modify the error code identifier of the initial error code information in the code file.

[0112] Optionally, in the code processing apparatus of the distributed system provided in this application embodiment, the first modification unit 34 includes: an identification module, configured to identify target code containing target error code information from the initial code for each target error code information, and replace the target error code in the target code with enumerated class data to obtain the updated target code; a processing module, configured to perform consistency processing on the updated target code according to the code attributes of the initial code to obtain replacement code; and a replacement module, configured to replace the target code in the initial code with the replacement code to obtain the updated code file.

[0113] Optionally, in the code processing apparatus of the distributed system provided in the embodiments of this application, the apparatus further includes: a second modification unit, configured to, upon receiving a modification instruction, obtain enumeration class data of the target error code information indicated by the modification instruction, and modify the enumeration class data, wherein the modification instruction is used to indicate modification of any one of the target error code information; and a second generation unit, configured to, upon receiving an add instruction, generate new enumeration class data of the newly added error code information carried by the add instruction, and store the new enumeration class data in a target storage area, wherein the target storage area is used to store N enumeration class data corresponding to the code file, and the add instruction is used to indicate the addition of new error code information.

[0114] Optionally, in the code processing apparatus for a distributed system provided in this application embodiment, the apparatus further includes: a first determining unit, configured to determine the enumeration class data associated with the error code usage code and obtain the error code annotation in the enumeration class data when the error code usage code in any target node of the distributed system is triggered; a first judging unit, configured to judge whether there is custom information of the error code annotation in the target node; a second determining unit, configured to determine the custom information as the error information of the target node when there is custom information in the target node; a second judging unit, configured to judge whether there is descriptive information of the error code annotation when there is no custom information in the target node; a third determining unit, configured to determine the descriptive information as the error information of the target node when there is descriptive information of the error code annotation; a fourth determining unit, configured to determine the error code annotation as the error information of the target node when there is no descriptive information of the error code annotation; and a feedback unit, configured to feed back the error information to the client that triggered the error code usage code.

[0115] Optionally, in the code processing apparatus of the distributed system provided in this application embodiment, the fourth determining unit includes: an acquisition module, used to acquire context information from the configuration file of the code file according to the error information, wherein the context information is the context information of the error code corresponding to the error information; and an adding module, used to add the context information to the error information to obtain the updated error information, and to feed back the updated error information to the client.

[0116] Optionally, in the code processing apparatus of the distributed system provided in this application embodiment, the fourth determining unit includes: a third judging module, used to send error information to a target queue and judge whether the number of error information in the target queue is greater than or equal to a preset number; a first feedback module, used to feed back all error information in the target queue when the number of error information is greater than or equal to the preset number; a fourth judging module, used to judge whether the information feedback time has been reached when the number of error information is less than the preset number; a second feedback module, used to feed back all error information in the target queue when the information feedback time has been reached; and an execution module, used to perform a waiting operation until the information feedback time is reached or the number of error information is equal to the preset number when the information feedback time has not been reached.

[0117] It should be noted that the aforementioned acquisition unit 31, processing unit 32, first generation unit 33, and first modification unit 34 correspond to steps S201 to S204 in Embodiment 1. The instances and application scenarios implemented by each of these units and their corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1. It should also be noted that the aforementioned modules or units can be hardware or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). These modules can also run as part of a device in the computer terminal 10 provided in Embodiment 1.

[0118] Example 3

[0119] Embodiments of this application may provide an electronic device. Figure 4 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 4 As shown, the electronic device may include: one or more ( Figure 4 (Only one is shown) processor 1002, memory 1004, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.

[0120] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the above-described methods. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0121] Those skilled in the art will understand that Figure 4 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 4 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 4 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 4 The different configurations shown.

[0122] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0123] Example 4

[0124] Embodiments of this application also provide a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the code processing method of the distributed system provided in Embodiment 1.

[0125] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.

[0126] Embodiments of this application also provide a computer program product, which, when executed on a data processing device, is a program adapted to perform the steps of a code processing method for a distributed system.

[0127] Embodiments of this application also provide a computer-readable storage medium, which includes a stored executable program, wherein, when the executable program is running, it controls the device where the computer-readable storage medium is located to execute the above-described code processing method for a distributed system.

[0128] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0129] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0130] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0131] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0132] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0133] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0134] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A code processing method for a distributed system, characterized in that, include: Obtain the code file of the system node in the distributed system, and scan the code file to obtain the initial error code information set in the code file. The initial error code information set includes M initial error code information, and the initial error code information includes error code identifier and error code comment, where M is a positive integer. The initial error code information set is deduplicated to obtain the target error code information set, wherein the target error code information set includes N target error code information, where N is a positive integer and M is greater than N; Generate enumeration class data for each target error code information sequentially to obtain N enumeration class data; In the code file, the initial code associated with the corresponding target error code information is modified according to each enumeration class data to obtain the updated code file.

2. The method according to claim 1, characterized in that, The initial error code information set is deduplicated to obtain the target error code information set, which includes: Determine whether there exists an initial error code information pair with the same error code identifier in the initial error code information set; If there is no initial error code information pair with the same error code identifier, the initial error code information set shall be determined as the target error code information set; In the case of existing pairs of initial error code information with the same error code identifier, determine whether the error code annotations of the initial error code information pairs are the same; If the error code comments are the same, delete any one of the initial error code information from the initial error code information pair from the initial error code information set; If the error code comments are different, modify the error code identifier of any one of the initial error code information in the initial error code information pair, and modify the error code identifier of the initial error code information in the code file.

3. The method according to claim 1, characterized in that, The initial code associated with the corresponding target error code information is modified according to each enumeration class data, resulting in the updated code file including: For each target error code, identify the target code containing the target error code information from the initial code, and replace the target error code in the target code with the enumerated class data to obtain the updated target code; Based on the code attributes of the initial code, the updated target code is subjected to consistency processing to obtain the replacement code; The target code in the initial code is replaced with the replacement code to obtain the updated code file.

4. The method according to claim 1, characterized in that, The method further includes: Upon receiving a modification instruction, the system obtains enumeration data of the target error code information indicated by the modification instruction and modifies the enumeration data, wherein the modification instruction is used to indicate modification of any target error code information; Upon receiving an add instruction, new enumeration class data carrying the new error code information is generated, and the new enumeration class data is stored in a target storage area. The target storage area is used to store the N enumeration class data corresponding to the code file, and the add instruction is used to indicate the addition of the new error code information.

5. The method according to claim 1, characterized in that, The method further includes: If an error code is detected to be triggered in any target node of the distributed system, the enumeration class data associated with the error code is determined, and the error code annotation in the enumeration class data is obtained. Determine whether the target node contains custom information for the error code annotation; If the custom information exists in the target node, the custom information will be identified as error information of the target node. If the custom information is not present in the target node, determine whether the description information of the error code annotation exists; If the description information of the error code annotation exists, the description information is determined to be the error information of the target node; If the description information of the error code annotation is not available, the error code annotation is determined to be the error information of the target node; The error message is then sent back to the client that triggered the error code.

6. The method according to claim 5, characterized in that, Sending the error message back to the client that triggered the error code includes: Context information is obtained from the configuration file of the code file based on the error information, wherein the context information is the context information of the error code corresponding to the error information; The context information is added to the error information to obtain the updated error information, and the updated error information is then fed back to the client.

7. The method according to claim 5, characterized in that, Sending the error message back to the client that triggered the error code includes: The error message is sent to the target queue, and it is determined whether the number of error messages in the target queue is greater than or equal to a preset number. If the number of error messages is greater than or equal to the preset number, all error messages in the target queue will be fed back. If the number of error messages is less than the preset number, determine whether the information feedback time has been reached; Upon reaching the information feedback time, all error messages in the target queue will be fed back. If the information feedback time has not been reached, a waiting operation is performed until the information feedback time is reached or the number of error messages equals the preset number.

8. A code processing device for a distributed system, characterized in that, include: The acquisition unit is used to acquire the code file of the system node in the distributed system, and scan the code file to obtain the initial error code information set in the code file. The initial error code information set includes M initial error code information, and the initial error code information includes error code identifier and error code comment, where M is a positive integer. The processing unit is used to perform a deduplication operation on the initial error code information set to obtain a target error code information set, wherein the target error code information set includes N target error code information, where N is a positive integer and M is greater than N; The first generation unit is used to sequentially generate enumeration class data for each target error code information, resulting in N enumeration class data. The first modification unit is used to modify the initial code associated with the corresponding target error code information in the code file according to each enumeration class data, so as to obtain the updated code file.

9. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the steps of the code processing method for the distributed system according to any one of claims 1 to 7.

10. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program executes the code processing method of the distributed system according to any one of claims 1 to 7 when it runs.