A method and device for displaying abnormal information of code
By monitoring the abnormal items when the code is running, and using the exception configuration file to determine and display the exception information in plain text, it solves the problem of unintuitive exception information in the existing technology and improves the developer's troubleshooting efficiency.
Patent Information
- Application Number
- CN202110018282.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-07
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-01-07
AI Technical Summary
The exception information generated by existing compilers is not intuitive enough, making it difficult for developers to quickly troubleshoot program problems, and additional code needs to be written for analysis, which reduces troubleshooting efficiency.
By monitoring the abnormal items when the code is running, the exception configuration file is used to determine the exception information in plain text and display the code problems. The configuration file includes multiple abnormal items and their corresponding information in plain text to intuitively present program problems.
It improves the efficiency of developers in troubleshooting problems, intuitively displays exception information in plain text, and simplifies the problem troubleshooting process.
Smart Images

Figure CN113760720B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for displaying abnormal information of a code. Background Art
[0002] During the program development process, since the program is not yet complete, various problems will inevitably arise when the program is running in the compiler. At this time, the compiler will generate exception information for the problems encountered during program runtime to help developers troubleshoot the problems.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0004] Currently, there are two types of exception information generated by the compiler: one is to generate an Exception object to report the code location where the problem occurs, and the other is to generate a status code to report the type of problem. However, these two methods are not intuitive enough to show program problems, which makes it difficult for developers to quickly troubleshoot problems. In addition, the compiler uses these two methods randomly, and developers need to write additional code to parse the exception information, which further reduces the efficiency of developers in troubleshooting. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a method and device for displaying code exception information. When a code running exception is monitored, a first exception item of the code can be determined, and then first exception information corresponding to the first exception item can be determined according to an exception configuration file, and the first exception information can be displayed in plain text; wherein the exception configuration file includes multiple second exception items and second exception information in plain text corresponding to the multiple second exception items, thereby intuitively displaying program problems in plain text, thereby improving the efficiency of developers in troubleshooting problems.
[0006] To achieve the above objective, according to one aspect of an embodiment of the present invention, a method for displaying abnormal information of a code is provided.
[0007] A method for displaying abnormal information of a code according to an embodiment of the present invention includes:
[0008] Monitor the execution of the code;
[0009] When the code runs abnormally, determining the first abnormal item of the code;
[0010] Determine, according to the abnormal configuration file, first abnormal information corresponding to the first abnormal item; the abnormal configuration file includes: a plurality of second abnormal items and second abnormal information in plain text form corresponding to the plurality of second abnormal items;
[0011] Display the first exception information in plain text.
[0012] Optionally,
[0013] The plurality of second abnormal items correspond to different levels;
[0014] Determining first abnormal information corresponding to the first abnormal item includes:
[0015] According to the category to which the first abnormal item belongs, searching in the abnormal configuration file for a second abnormal item of the highest level corresponding to the category;
[0016] Determine whether the second abnormal item at the highest level has a lower level item, and if not, use the second abnormal information corresponding to the second abnormal item at the highest level as the first abnormal information.
[0017] Optionally,
[0018] When it is determined that the second abnormal item at the highest level has a lower level item, the method further includes:
[0019] Determine, in the subordinate items of the second abnormal item, a subordinate item corresponding to the first abnormal item according to the abnormal field in the first abnormal item;
[0020] The second abnormal information corresponding to the determined lower-level item is used as the first abnormal information.
[0021] Optionally,
[0022] The exception configuration file includes one or more language versions, and the method further includes:
[0023] The language of the code running environment is determined, the language version of the exception configuration file is determined according to the language of the running environment, and the first exception information is displayed according to the determined language version.
[0024] Optionally,
[0025] There are multiple exception configuration files, and the exception configuration files are stored in an online server;
[0026] After determining the first abnormal item of the code, including:
[0027] According to the first abnormal item, an abnormal configuration file corresponding to the first abnormal item is downloaded from the online server to the local computer, and first abnormal information corresponding to the first abnormal item is determined according to the downloaded abnormal configuration file.
[0028] Optionally,
[0029] Abnormal configuration files are stored in online servers;
[0030] After determining the first abnormal item of the code, including:
[0031] According to the first abnormal item, obtaining, from the abnormal configuration file of the online server, a second abnormal item corresponding to the first abnormal item and second abnormal information corresponding to the second abnormal item;
[0032] Based on the second abnormal information, the first abnormal information is generated and displayed.
[0033] Optionally,
[0034] The first exception information includes any one or more of the following: an exception code, an exception description information in plain text, and an exception resolution strategy in plain text.
[0035] To achieve the above objective, according to another aspect of an embodiment of the present invention, a device for displaying abnormal information of a code is provided.
[0036] A device for displaying abnormal information of a code according to an embodiment of the present invention comprises a monitoring module, an abnormal item determination module, an abnormal information determination module and a display module; wherein:
[0037] Monitoring module, used to monitor the running of code;
[0038] An abnormal item determination module, used for determining a first abnormal item of the code when the code runs abnormally;
[0039] An abnormal information determination module is used to determine the first abnormal information corresponding to the first abnormal item according to the abnormal configuration file; the abnormal configuration file includes: a plurality of second abnormal items and second abnormal information in plain text corresponding to the plurality of second abnormal items;
[0040] The display module is used to display the first abnormal information in plain text.
[0041] To achieve the above objective, according to another aspect of an embodiment of the present invention, there is provided an electronic device for displaying abnormal information of a code.
[0042] An electronic device for displaying abnormal information of a code according to an embodiment of the present invention comprises: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by one or more processors, the one or more processors implement a method for displaying abnormal information of a code according to an embodiment of the present invention.
[0043] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided.
[0044] A computer-readable storage medium according to an embodiment of the present invention stores a computer program, which, when executed by a processor, implements a method for displaying abnormal information of a code according to an embodiment of the present invention.
[0045] An embodiment of the above invention has the following advantages or beneficial effects: when an abnormal code operation is monitored, the first abnormal item of the code can be determined, and then the first abnormal information corresponding to the first abnormal item can be determined according to the abnormal configuration file, and the first abnormal information can be displayed in plain text; wherein the abnormal configuration file includes multiple second abnormal items and second abnormal information in plain text corresponding to the multiple second abnormal items, thereby intuitively displaying the program problems in plain text, thereby improving the efficiency of developers in troubleshooting problems.
[0046] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific implementation examples. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0048] Figure 1 is a schematic diagram of the main steps of a method for displaying abnormal information of a code according to an embodiment of the present invention;
[0049] Figure 2 is a schematic diagram of main steps of a method for determining first abnormal information corresponding to a first abnormal item according to an embodiment of the present invention;
[0050] Figure 3 is a schematic diagram of main modules of a device for displaying abnormal information of a code according to an embodiment of the present invention;
[0051] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0052] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0053] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0054] It should be pointed out that the embodiments of the present invention and the technical features therein may be combined with each other without conflict.
[0055] Figure 1 It is a schematic diagram of the main steps of a method for displaying abnormal information of a code according to an embodiment of the present invention.
[0056] like Figure 1 As shown, a method for displaying abnormal information of a code according to an embodiment of the present invention mainly includes the following steps:
[0057] Step S101: monitoring the execution of the code.
[0058] Step S102: When the code runs abnormally, a first abnormal item of the code is determined.
[0059] In an embodiment of the present invention, the first abnormal item of the code may be one or more abnormal statements captured during the running of the code, wherein each abnormal statement may contain an abnormal field, and the abnormal field may be a missing field, a redundant field, or an assignment that does not conform to the type of the field, etc.
[0060] Step S103: determining first abnormal information corresponding to the first abnormal item according to the abnormal configuration file; the abnormal configuration file includes: a plurality of second abnormal items and second abnormal information in plain text format corresponding to the plurality of second abnormal items.
[0061] In an embodiment of the present invention, when the code runs abnormally and needs to report information corresponding to the exception, the corresponding first exception information can be determined according to the first exception item of the code. In a preferred embodiment of the present invention, the first exception information can be passed to the caller of the information through an ErrorMessage object, and the ErrorMessage object can be generated by an exception information factory class, namely, the ErrorMessageFactory class. Specifically, the ErrorMessageFactory class can operate MessageResourceAccessor to construct an ErrorMessage object through a set of static methods in the corresponding ErrorMessageBuilder class to reduce the complexity of constructing various types of first exception information.
[0062] In an embodiment of the present invention, the first abnormal project and its corresponding first abnormal information are recorded in an abnormal configuration file, which can be stored in an online server or locally. The abnormal configuration file includes: multiple second abnormal projects, and the second abnormal information in plain text corresponding to these second abnormal projects. When the code runs abnormally and captures the first abnormal project, the first abnormal information corresponding to the first abnormal project can be hit from the multiple second abnormal information in the abnormal configuration file according to the first abnormal project.
[0063] For example, the content of an exception configuration file can be:
[0064] Account.add-business-error\:AccountIsExistError=Failed to add account, current pin:[{0}] already exists;
[0065] Account.load-business-error\:PinNotExistError=Failed to load the account object. The current pin: [{0}] does not exist.
[0066] Account.changeParent-business-error\:PinNotExistError=Failed to update parent pin, the current parent pin: [{0}] does not exist.
[0067] Among them, the second abnormal item Account.add-business-error\ corresponds to the second abnormal information "Failed to add account, current pin: [{0}] already exists"; the second abnormal item Account.load-business-error\ corresponds to the second abnormal information "Failed to load the account object, current pin: [{0}] does not exist". When the first abnormal item Account.add-business-error\ is captured, the corresponding first abnormal information "Failed to add account, current pin: [{0}] already exists" is hit from the abnormal configuration file.
[0068] In an embodiment of the present invention, the second abnormal item in the abnormal configuration file can adopt a hierarchical structure design, that is, multiple second abnormal items correspond to different levels, and the higher the level, the coarser the second abnormal information obtained by analyzing the second abnormal item; the lower the level, the finer the second abnormal information obtained by analyzing the second abnormal item.
[0069] Therefore, in the embodiment of the present invention, after determining the first abnormal item of the code, such as Figure 2 As shown, Figure 2 2 is a schematic diagram of main steps of a method for determining first abnormal information corresponding to a first abnormal item according to an embodiment of the present invention. The method mainly includes the following steps:
[0070] Step S201: according to the category to which the first abnormal item belongs, searching the abnormal configuration file for the second abnormal item of the highest level corresponding to the category;
[0071] Step S202: Determine whether the second abnormal item at the highest level has a lower level item, if not, execute step S203, if yes, execute steps S204-S205;
[0072] Step S203: taking the second abnormal information corresponding to the second abnormal item of the highest level as the first abnormal information;
[0073] Step S204: determining, according to the abnormal field in the first abnormal item, a subordinate item corresponding to the first abnormal item in the subordinate items of the second abnormal item;
[0074] Step S205: taking the determined second abnormality information corresponding to the lower-level item as the first abnormality information.
[0075] In a preferred embodiment of the present invention, the second exception item in the exception configuration file corresponds to two levels, so the corresponding second exception information also includes two levels, namely the main exception part and the sub-exception part. Among them, each sub-exception corresponds to a main exception, and each main exception can have several seed exceptions. Among them, the main exception part and the sub-exception part of the second exception information can include any one or more of the following: exception coding, exception description information in plain text, and exception resolution strategy in plain text. When the main exception part and / or the sub-exception part of the second exception information include both the exception coding and the exception description information in plain text, the exception coding and the exception description information in plain text can be saved in the exception configuration file in the form of key-value pairs.
[0076] For example, the content of an exception configuration file can be:
[0077]
[0078] Among them, the main exception code in the second exception information is 7, which means that a required parameter is missing. The plain text exception description message also prompts "missing required parameters" to facilitate developers to troubleshoot problems. The plain text exception solution is the proposed processing plan for the exception, prompting "please add required parameters according to the interface documentation" to facilitate developers to solve problems. subErrors is a list of sub-exception information, which contains two sub-exception: missing parameter locale and missing parameter pin. The sub-exception code is a string that is hierarchically encoded according to the main exception type, such as missing-parameter:6x, 6x-not-exist:invalid-7y, where 6x and 7y are placeholder fields and will be replaced with corresponding exception fields according to the specific exception.
[0079] In a preferred embodiment of the present invention, the exception configuration file provides a default framework DefaltErrorMessage for the second exception item, in which 13 main exceptions are defined, covering all possible main exception types, and the main exception part does not support extension; wherein, the main exception type is a sub-exception part of the business exception that supports extension, and the caller can define the sub-exception information by itself, and configure the defined sub-exception information into the exception configuration file.
[0080] In an embodiment of the present invention, the exception configuration file may also include one or more language versions, and the exception configuration files corresponding to each language version are packaged and stored separately. In this way, when the code runs abnormally, the language of the code running environment can be determined first, and then the language version of the exception configuration file can be determined according to the language of the running environment, and the first exception information can be displayed according to the determined language version, so as to expand the application scenario of the present solution and also facilitate developers to read the first exception information.
[0081] In an embodiment of the present invention, when there are multiple exception configuration files and the exception configuration files are stored in an online server, after determining the first exception item of the code, the resource loader can download the exception configuration file corresponding to the first exception item from the online server to the local computer according to the first exception item, and then the resource accessor determines the first exception information corresponding to the first exception item according to the downloaded exception configuration file. Specifically, the underlying layer of the resource loader loading the exception configuration file is implemented based on the java.util.ResourceBundle class provided by JDK, and the core implementation of the exception configuration file processing is the PropertyBundleMessageResource class, which uses java.util.ResourceBundle to implement the loading of the exception configuration file, caches and manages the exception configuration file, and supports the management of exception configuration files in multiple language versions; and the resource accessor instantiates a MessageResource object through the access tool class MessageResourceAccessor, and then accesses the second exception item and the second exception information in the exception configuration file downloaded to the local computer through the getMessage public method.
[0082] In an embodiment of the present invention, when the abnormal configuration file is stored in an online server, the abnormal configuration file can also be directly traversed on the online server to hit the second abnormal information. Specifically: after determining the first abnormal item of the code, the second abnormal item corresponding to the first abnormal item and the second abnormal information corresponding to the second abnormal item can be obtained from the abnormal configuration file of the online server according to the first abnormal item, and then the first abnormal information is generated and displayed according to the second abnormal information.
[0083] In the embodiment of the present invention, the first exception information may include any one or more of the following: an exception code, exception description information in plain text, and an exception resolution strategy in plain text.
[0084] Step S104: Display the first abnormal information in plain text.
[0085] In the embodiment of the present invention, the first exception information is displayed in plain text, which intuitively shows the problem of the code, and further improves the efficiency of developers in troubleshooting problems.
[0086] It can be seen from a method for displaying code exception information according to an embodiment of the present invention that when a code running exception is monitored, a first exception item of the code can be determined, and then based on an exception configuration file, first exception information corresponding to the first exception item can be determined, and the first exception information can be displayed in plain text; wherein the exception configuration file includes multiple second exception items and second exception information in plain text corresponding to the multiple second exception items, thereby intuitively displaying program problems in plain text, thereby improving the efficiency of developers in troubleshooting problems.
[0087] Figure 3 It is a schematic diagram of main modules of a device for displaying abnormal information of a code according to an embodiment of the present invention.
[0088] like Figure 3 As shown, a device 300 for displaying abnormal information of a code according to an embodiment of the present invention includes a monitoring module 301, an abnormal item determination module 302, an abnormal information determination module 303 and a display module 304; wherein:
[0089] A monitoring module 301 is used to monitor the running of the code;
[0090] The abnormal item determination module 302 is used to determine the first abnormal item of the code when the code runs abnormally;
[0091] The abnormal information determination module 303 is used to determine the first abnormal information corresponding to the first abnormal item according to the abnormal configuration file; the abnormal configuration file includes: a plurality of second abnormal items and the second abnormal information in plain text format corresponding to the plurality of second abnormal items respectively;
[0092] The display module 304 is used to display the first abnormal information in plain text.
[0093] In an embodiment of the present invention, multiple second abnormal items correspond to different levels; the abnormal information determination module 303 is further used to: according to the category to which the first abnormal item belongs, search for the second abnormal item of the highest level corresponding to the category in the abnormal configuration file; determine whether the second abnormal item of the highest level has a lower-level item, and if not, use the second abnormal information corresponding to the second abnormal item of the highest level as the first abnormal information.
[0094] In an embodiment of the present invention, when it is determined that the second abnormal item at the highest level has subordinate items, the abnormal information determination module 303 is further used to: determine the subordinate item corresponding to the first abnormal item in the subordinate items of the second abnormal item according to the abnormal field in the first abnormal item; and use the second abnormal information corresponding to the determined subordinate item as the first abnormal information.
[0095] In an embodiment of the present invention, the exception configuration file includes one or more language versions, and the exception information determination module 303 is further used to: determine the language of the code running environment, determine the language version of the exception configuration file according to the language of the running environment, and display the first exception information according to the determined language version.
[0096] In an embodiment of the present invention, there are multiple exception configuration files, and the exception configuration files are stored in an online server; the exception information determination module 303 is further used to: according to the first abnormal item, download the exception configuration file corresponding to the first abnormal item from the online server to the local, and determine the first abnormal information corresponding to the first abnormal item according to the downloaded exception configuration file.
[0097] In an embodiment of the present invention, the abnormal configuration file is stored in an online server; the abnormal information determination module 303 is further used to: according to the first abnormal item, obtain the second abnormal item corresponding to the first abnormal item and the second abnormal information corresponding to the second abnormal item from the abnormal configuration file of the online server; according to the second abnormal information, generate and display the first abnormal information.
[0098] In the embodiment of the present invention, the first exception information includes any one or more of the following: an exception code, an exception description information in plain text, and an exception resolution strategy in plain text.
[0099] It can be seen from a device for displaying code exception information according to an embodiment of the present invention that when a code running exception is monitored, a first exception item of the code can be determined, and then, based on an exception configuration file, first exception information corresponding to the first exception item can be determined, and the first exception information can be displayed in plain text; wherein the exception configuration file includes multiple second exception items and second exception information in plain text corresponding to the multiple second exception items, thereby intuitively displaying program problems in plain text, thereby improving the efficiency of developers in troubleshooting problems.
[0100] Figure 4 An exemplary system architecture 400 is shown to which a method for displaying abnormal information of a code or an apparatus for displaying abnormal information of a code according to an embodiment of the present invention can be applied.
[0101] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, 403, network 404 and electronic device 405. Network 404 is used to provide a medium for communication links between terminal devices 401, 402, 403 and electronic device 405. Network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0102] The user can use the terminal devices 401, 402, 403 to interact with the electronic device 405 through the network 404 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 401, 402, 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0103] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0104] The electronic device 405 may be a server that provides various services, such as a background management server that provides support for shopping websites browsed by users using the terminal devices 401, 402, and 403. The background management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information and product information) to the terminal device.
[0105] It should be noted that the method for displaying abnormal information of a code provided in the embodiment of the present invention is generally executed by the electronic device 405 , and accordingly, a device for displaying abnormal information of a code is generally arranged in the electronic device 405 .
[0106] It should be understood that Figure 4 The number of terminal devices, networks and electronic devices in the embodiment is only for illustration. Any number of terminal devices, networks and electronic devices may be provided according to implementation requirements.
[0107] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device suitable for implementing an embodiment of the present invention. Figure 5 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0108] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0109] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0110] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.
[0111] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0112] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0113] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be provided in a processor, for example, may be described as: a processor including a monitoring module, an abnormal item determination module, an abnormal information determination module, and a display module. The names of these modules do not, in certain cases, constitute limitations on the modules themselves, for example, the monitoring module may also be described as a "module for monitoring the running of the code".
[0114] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: monitoring the running of the code; when the code runs abnormally, determining the first abnormal item of the code; determining the first abnormal information corresponding to the first abnormal item according to the abnormal configuration file; the abnormal configuration file includes: multiple second abnormal items and second abnormal information in plain text corresponding to the multiple second abnormal items; displaying the first abnormal information in plain text.
[0115] According to the technical solution of the embodiment of the present invention, when an abnormal code operation is monitored, the first abnormal item of the code can be determined, and then the first abnormal information corresponding to the first abnormal item can be determined according to the abnormal configuration file, and the first abnormal information can be displayed in plain text; wherein the abnormal configuration file includes multiple second abnormal items and second abnormal information in plain text corresponding to the multiple second abnormal items, thereby intuitively displaying the problem of the program in plain text, improving the efficiency of developers in troubleshooting problems.
[0116] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for displaying abnormal information of a code, characterized in that: include: Monitor the execution of the code; When the code runs abnormally, determining a first abnormal item of the code; According to the abnormal configuration file, first abnormal information corresponding to the first abnormal item is determined; specifically comprising: according to the category to which the first abnormal item belongs, searching the abnormal configuration file for a second abnormal item of the highest level corresponding to the category; determining whether the second abnormal item of the highest level has a subordinate item, and if not, using the second abnormal information corresponding to the second abnormal item of the highest level as the first abnormal information; the abnormal configuration file comprises: a plurality of second abnormal items and second abnormal information in plain text form corresponding to the plurality of second abnormal items, wherein the plurality of second abnormal items correspond to different levels; The first abnormal information is displayed in plain text.
2. The method according to claim 1, characterized in that When it is determined that the second abnormal item at the highest level has a lower level item, the method further includes: Determining, according to the abnormal field in the first abnormal item, a subordinate item corresponding to the first abnormal item in the subordinate items of the second abnormal item; The determined second abnormal information corresponding to the lower-level item is used as the first abnormal information.
3. The method according to claim 1, characterized in that The abnormal configuration file includes one or more language versions, and the method further includes: Determine the language of the code running environment, determine the language version of the exception configuration file according to the language of the running environment, and display the first exception information according to the determined language version.
4. The method according to claim 1, characterized in that: There are multiple abnormal configuration files, and the abnormal configuration files are stored in an online server; After determining the first abnormal item of the code, the method further comprises: According to the first abnormal item, an abnormal configuration file corresponding to the first abnormal item is downloaded from the online server to a local computer, and first abnormal information corresponding to the first abnormal item is determined according to the downloaded abnormal configuration file.
5. The method according to claim 1, characterized in that The abnormal configuration file is stored in an online server; After determining the first abnormal item of the code, the method further comprises: According to the first abnormal item, acquiring, from the abnormal configuration file of the online server, a second abnormal item corresponding to the first abnormal item and second abnormal information corresponding to the second abnormal item; The first exception information is generated and displayed according to the second exception information.
6. The method according to any one of claims 1 to 5, characterized in that: The first exception information includes any one or more of the following: an exception code, an exception description information in plain text, and an exception resolution strategy in plain text.
7. A device for displaying abnormal information of a code, characterized in that: It includes a monitoring module, an abnormal item determination module, an abnormal information determination module and a display module; wherein: The monitoring module is used to monitor the running of the code; The abnormal item determination module is used to determine a first abnormal item of the code when the code runs abnormally; The abnormal information determination module is used to determine the first abnormal information corresponding to the first abnormal item according to the abnormal configuration file; specifically used to: according to the category to which the first abnormal item belongs, search the abnormal configuration file for the second abnormal item of the highest level corresponding to the category; determine whether the second abnormal item of the highest level has a subordinate item, and if not, use the second abnormal information corresponding to the second abnormal item of the highest level as the first abnormal information; the abnormal configuration file includes: a plurality of second abnormal items and second abnormal information in plain text corresponding to the plurality of second abnormal items, and the plurality of second abnormal items correspond to different levels; The display module is used to display the first abnormal information in plain text.
8. An electronic device for displaying abnormal information of a code, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Method and system for displaying error code information of software
CN106874163A
Abnormality processing method and apparatus, electronic terminal and readable storage medium
CN108446185A
