CN113760720A - Code abnormal information display method and device - Google Patents
Code abnormal information display method and device Download PDFInfo
- Publication number
- CN113760720A CN113760720A CN202110018282.8A CN202110018282A CN113760720A CN 113760720 A CN113760720 A CN 113760720A CN 202110018282 A CN202110018282 A CN 202110018282A CN 113760720 A CN113760720 A CN 113760720A
- Authority
- CN
- China
- Prior art keywords
- abnormal
- item
- exception
- information
- code
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 230000002159 abnormal effect Effects 0.000 title claims abstract description 301
- 238000000034 method Methods 0.000 title claims abstract description 49
- 238000012544 monitoring process Methods 0.000 claims abstract description 14
- 238000004590 computer program Methods 0.000 claims description 11
- 238000013024 troubleshooting Methods 0.000 abstract description 8
- 238000010586 diagram Methods 0.000 description 13
- 238000004891 communication Methods 0.000 description 7
- 238000012545 processing Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 6
- 230000008569 process Effects 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 4
- 238000007726 management method Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 239000000835 fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 230000008859 change Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/3644—Software debugging by instrumenting at runtime
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a method and a device for displaying abnormal information of a code, and relates to the technical field of computers. One embodiment of the method comprises: monitoring the running of the code; when the code runs abnormally, determining a first abnormal item of the code; determining first abnormal information corresponding to the first abnormal item according to the abnormal configuration file; the exception configuration file includes: second abnormal information in a plaintext form corresponding to the plurality of second abnormal items and the plurality of second abnormal items respectively; and displaying the first abnormal information in a plaintext form. The method and the device visually display the problem of the program in a plaintext form, and improve the efficiency of troubleshooting of developers.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for displaying abnormal information of a code.
Background
In the process of program development, because a program is not complete, various problems inevitably occur when the program runs in a compiler, and at the moment, the compiler generates abnormal information aiming at the problems in the process of program running so as to help a developer to troubleshoot the problems.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
currently, Exception information generated by a compiler includes two types, namely, reporting the code position of a problem by generating an Exception object, and reporting the type of the problem by generating a status code. However, the two modes are not intuitive enough to display the program problems, so that the problem cannot be quickly checked by developers, and the compiler randomly uses the two modes, so that the developers need to write additional codes to analyze abnormal information, and the problem checking efficiency of the developers is further reduced.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for displaying abnormal information of a code, where when it is monitored that a code runs abnormally, a first abnormal item of the code can be determined, according to an abnormal configuration file, first abnormal information corresponding to the first abnormal item is determined, and the first abnormal information is displayed in a plaintext form; the abnormal configuration file comprises a plurality of second abnormal items and second abnormal information in a plaintext form corresponding to the second abnormal items respectively, so that the problem of the program is visually presented in the plaintext form, and the problem troubleshooting efficiency of developers is improved.
To achieve the above object, according to an aspect of the embodiments of the present invention, a method for displaying exception information of a code is provided.
The method for displaying the abnormal information of the code comprises the following steps:
monitoring the running of the code;
when the code runs abnormally, determining a first abnormal item of the code;
determining first abnormal information corresponding to the first abnormal item according to the abnormal configuration file; the exception configuration file includes: second abnormal information in a plaintext form corresponding to the plurality of second abnormal items and the plurality of second abnormal items respectively;
and displaying the first abnormal information in a plaintext form.
Alternatively,
the plurality of second exception items correspond to different hierarchical levels;
determining first abnormal information corresponding to the first abnormal item, wherein the determining comprises the following steps:
searching a second abnormal item of the highest level corresponding to the category in the abnormal configuration file according to the category to which the first abnormal item belongs;
and determining whether the second abnormal item of the highest level has a lower level item, and if not, taking the second abnormal information corresponding to the second abnormal item of the highest level as the first abnormal information.
Alternatively,
when it is determined that the subordinate item exists in the second abnormal item of the highest hierarchy level, the method further comprises the following steps:
determining a lower item corresponding to the first abnormal item in the lower items of the second abnormal item according to the abnormal field in the first abnormal item;
and taking the second abnormal information corresponding to the determined lower-level item as the first abnormal information.
Alternatively,
the exception configuration file includes one or more language versions, the method further comprising:
determining the language of the code operating environment, determining the language version of the abnormal configuration file according to the language of the operating environment, and displaying the first abnormal information according to the determined language version.
Alternatively,
the abnormal configuration files are multiple and stored in the online server;
after determining the first exception entry of the code, comprising:
and according to the first abnormal item, downloading an abnormal configuration file corresponding to the first abnormal item from the online server to the local, and according to the downloaded abnormal configuration file, determining first abnormal information corresponding to the first abnormal item.
Alternatively,
storing the abnormal configuration file in an online server;
after determining the first exception entry of the code, comprising:
according to the first abnormal item, acquiring a second abnormal item corresponding to the first abnormal item and second abnormal information corresponding to the second abnormal item from an abnormal configuration file of the online server;
and generating and displaying the first abnormal information according to the second abnormal information.
Alternatively,
the first anomaly information includes any one or more of: the method comprises the steps of exception encoding, exception description information in a plaintext form and an exception resolution strategy in the plaintext form.
To achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided an exception information presentation apparatus for a code.
The device for displaying the abnormal information of the code comprises a monitoring module, an abnormal item determining module, an abnormal information determining module and a displaying module; wherein:
the monitoring module is used for monitoring the running of the code;
the abnormal item determining module is used for determining a first abnormal item of the code when the code runs abnormally;
the abnormal information determining module is used for determining first abnormal information corresponding to the first abnormal item according to the abnormal configuration file; the exception configuration file includes: second abnormal information in a plaintext form corresponding to the plurality of second abnormal items and the plurality of second abnormal items respectively;
and the display module is used for displaying the first abnormal information in a plaintext form.
To achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided an electronic device for displaying exception information of a code.
The abnormal information display electronic equipment of the code of the embodiment of the invention comprises: one or more processors; the storage device is used 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 realize the exception information display method of the code of the embodiment of the invention.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided a computer-readable storage medium.
A computer-readable storage medium of an embodiment of the present invention stores thereon a computer program, and when the computer program is executed by a processor, the computer program implements an abnormal information display method of a code of an embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: when the code running is monitored to be abnormal, a first abnormal item of the code can be determined, first abnormal information corresponding to the first abnormal item is determined according to an abnormal configuration file, and the first abnormal information is displayed in a plaintext form; the abnormal configuration file comprises a plurality of second abnormal items and second abnormal information in a plaintext form corresponding to the second abnormal items respectively, so that the problem of the program is visually presented in the plaintext form, and the problem troubleshooting efficiency of developers is improved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main steps of an exception information display method for a code according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating the main steps of a method for determining first anomaly information corresponding to a first anomaly item according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of the main modules of an exception information display apparatus for code according to an embodiment of the present invention;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 5 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that the embodiments of the present invention and the technical features of the embodiments may be combined with each other without conflict.
Fig. 1 is a schematic diagram illustrating main steps of an exception information display method for a code according to an embodiment of the present invention.
As shown in fig. 1, a method for displaying exception information of a code according to an embodiment of the present invention mainly includes the following steps:
step S101: and monitoring the running of the code.
Step S102: when the code runs abnormally, a first abnormal item of the code is determined.
In the embodiment of the invention, the first exception item of the code may be one or more exception statements captured by the code in the running process. Each exception statement may include an exception field, which may be a field missing, a field redundant or assigned value inconsistent with a field type, or the like.
Step S103: determining first abnormal information corresponding to the first abnormal item according to the abnormal configuration file; the exception configuration file includes: and the plurality of second abnormal items respectively correspond to the second abnormal information in a plain text form.
In the embodiment of the invention, when the code operation exception needs to report the 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 abnormal information may be transmitted to the information caller through an ErrorMessage object, and the ErrorMessage object may be generated by an abnormal information factory class, that is, an ErrorMessageFactory class, and specifically, the ErrorMessageFactory class may operate the message resourceaccessor to construct the ErrorMessage object through a set of static methods in the corresponding ErrorMessageBuilder class, so as to reduce the complexity of constructing various types of first abnormal information.
In the embodiment of the present invention, the first exception item and the corresponding first exception information are recorded in an exception configuration file, and the exception configuration file may be stored in an online server or may be stored locally. The exception configuration file comprises: a plurality of second abnormal items and second abnormal information in plain text form corresponding to the second abnormal items. When the code runs abnormally and captures the first abnormal item, the first abnormal information corresponding to the first abnormal item can be hit from the plurality of second abnormal information of the abnormal configuration file according to the first abnormal item.
For example, the contents of one exception profile may be:
add-business-error, account isexistererror, failure to add an account, and currently pin [ {0} ] already exists;
load-business-error \ pinnotexistererror ═ failure to load the account object, no current pin [ {0} ] exists;
account, change parent-business-error \ pinnotexistererror fails to update the parent pin, and the current parent pin [ {0} ] does not exist.
The second abnormal item account, add-business-error \ corresponds to second abnormal information, "account addition failed, and pin: [ {0} ] already exists at present"; the second exception item, account, load-business-error, corresponds to the second exception information, "load the object of the account fails, and currently pin: [ {0} ] does not exist". When the account, add-business-error \ is captured as the first exception item, the corresponding first exception information "add account failed, and pin: [ {0} ] already exists currently" is hit from the exception configuration file.
In the embodiment of the present invention, the second abnormal item in the abnormal configuration file may adopt a hierarchical structure design, that is, a plurality of second abnormal items correspond to different hierarchies, and the higher the hierarchy is, the coarser the second abnormal information obtained by analyzing the second abnormal item is; the lower the hierarchy is, the finer the granularity of the second abnormal information obtained by analyzing the second abnormal item is.
Therefore, in the embodiment of the present invention, after determining the first exception item of the code, as shown in fig. 2, fig. 2 is a schematic diagram of main steps of a method for determining first exception information corresponding to the first exception item according to the embodiment of the present invention, where the method mainly includes the following steps:
step S201: searching a second abnormal item of the highest level corresponding to the category in the abnormal configuration file according to the category to which the first abnormal item belongs;
step S202: determining whether a second abnormal item of the highest hierarchy has a lower-level item, if not, executing step S203, and if so, executing steps S204-S205;
step S203: taking second abnormal information corresponding to the second abnormal item of the highest level as first abnormal information;
step S204: determining a lower item corresponding to the first abnormal item in the lower items of the second abnormal item according to the abnormal field in the first abnormal item;
step S205: and taking the second abnormal information corresponding to the determined lower-level item as the first abnormal information.
In a preferred embodiment of the present invention, the second exception item in the exception configuration file corresponds to two levels, and therefore the corresponding second exception information also includes two levels, i.e. a main exception part and a sub exception part. Each sub-exception corresponds to one main exception, and each main exception can have a plurality of seed exceptions. The main exception part and the sub exception part of the second exception information may include any one or more of the following: the method comprises the steps of exception encoding, exception description information in a plaintext form and an exception resolution strategy in the plaintext form. When the main abnormal part and/or the sub abnormal part of the second abnormal information simultaneously comprise the abnormal code and the abnormal description information in the plaintext form, the abnormal code and the abnormal description information in the plaintext form can be saved in the abnormal configuration file in the form of a key-value pair.
For example, the contents of one exception profile may be:
the main exception code in the second exception information is 7, which represents that the bound filling parameter is absent, and the clear-text-form exception description information message also prompts that the "bound filling parameter is absent" so as to facilitate the problem troubleshooting of developers, and the clear-text-form exception resolution strategy solution is a processing plan suggested for the exception, and prompts that the "bound filling parameter is added according to the interface document description" so as to facilitate the developers to solve the problem. The subirors is a sub-exception information list, which contains two sub-exceptions, respectively: the absence of parameter locale and the absence of parameter pin. The sub-exception code is a character string hierarchically encoded according to the main exception type, such as missing-parameter:6x, 6 x-not-exists: invalid-7y, wherein 6x and 7y are both placeholder fields and are replaced with corresponding exception fields according to specific exceptions.
In a preferred embodiment of the present invention, the exception configuration file provides a default framework for the second exception item, which defines 13 main exceptions, covering all possible main exception types, and the main exception portion does not support extension; the main exception type is a sub exception part support extension of the business exception, sub exception information can be defined by a calling party, and the defined sub exception information is configured into an exception configuration file.
In the embodiment of the present invention, the exception configuration file may further include one or more language versions, and the exception configuration file corresponding to each language version is separately packaged and stored. Therefore, when the code runs abnormally, the language of the code running environment can be determined firstly, then the language version of the abnormal configuration file is determined according to the language of the running environment, and the first abnormal information is displayed according to the determined language version, so that the application scene of the scheme is expanded, and developers can read the first abnormal information conveniently.
In the embodiment of the present invention, when a plurality of exception configuration files are provided and the exception configuration files are stored in the online server, after the first exception item of the code is determined, the resource loader may download the exception configuration file corresponding to the first exception item from the online server to the local according to the first exception item, and then the resource accessor may determine the first exception information corresponding to the first exception item according to the downloaded exception configuration file. Specifically, the bottom layer of the resource loader for loading the abnormal configuration file is realized based on a java.util.resource pool class provided by JDK, the core realization of the abnormal configuration file processing is a property pool resource class, the class realizes the loading of the abnormal configuration file by using the java.util.resource pool, caches and manages the abnormal configuration file, and supports the management of the abnormal configuration files of multiple language versions; and the resource accessor instantiates a MessageResource object through the access tool class of the MessageResourceAccessor and accesses the second abnormal item and the second abnormal information in the local abnormal configuration file through the getMessage public method.
In the embodiment of the present invention, when the exception configuration file is stored in the online server, the exception configuration file may also be directly traversed by the online server to hit the second exception information. Specifically, the method comprises the following steps: after the first abnormal item of the code is determined, a second abnormal item corresponding to the first abnormal item and second abnormal information corresponding to the second abnormal item can be obtained from an 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.
In this embodiment of the present invention, the first exception information may include any one or more of the following: the method comprises the steps of exception encoding, exception description information in a plaintext form and an exception resolution strategy in the plaintext form.
Step S104: and displaying the first abnormal information in a plaintext form.
In the embodiment of the invention, the first abnormal information is displayed in a plaintext form, so that the problem of the code is visually displayed, and the efficiency of troubleshooting the problem by developers is further improved.
According to the method for displaying the abnormal information of the code, disclosed by the embodiment of the invention, when the abnormal operation of the code is monitored, a first abnormal item of the code can be determined, then first abnormal information corresponding to the first abnormal item is determined according to an abnormal configuration file, and the first abnormal information is displayed in a plaintext form; the abnormal configuration file comprises a plurality of second abnormal items and second abnormal information in a plaintext form corresponding to the second abnormal items respectively, so that the problem of the program is visually presented in the plaintext form, and the problem troubleshooting efficiency of developers is improved.
Fig. 3 is a schematic diagram of main modules of an exception information display apparatus for code according to an embodiment of the present invention.
As shown in fig. 3, an apparatus 300 for displaying exception information of a code according to an embodiment of the present invention includes a monitoring module 301, an exception item determining module 302, an exception information determining module 303, and a displaying module 304; wherein:
a monitoring module 301, configured to monitor running of a code;
an abnormal item determination module 302, configured to determine a first abnormal item of the code when the code runs abnormally;
an abnormal information determining module 303, configured to determine, according to the abnormal configuration file, first abnormal information corresponding to the first abnormal item; the exception configuration file includes: second abnormal information in a plaintext form corresponding to the plurality of second abnormal items and the plurality of second abnormal items respectively;
the displaying module 304 is configured to display the first abnormal information in a plaintext form.
In an embodiment of the present invention, the plurality of second exception items correspond to different hierarchies; the anomaly information determination module 303 is further configured to: searching a second abnormal item of the highest level corresponding to the category in the abnormal configuration file according to the category to which the first abnormal item belongs; and determining whether the second abnormal item of the highest level has a lower level item, and if not, taking the second abnormal information corresponding to the second abnormal item of the highest level as the first abnormal information.
In this embodiment of the present invention, when it is determined that the second abnormal item at the highest hierarchical level has a lower item, the abnormal information determining module 303 is further configured to: determining a lower item corresponding to the first abnormal item in the lower items of the second abnormal item according to the abnormal field in the first abnormal item; and taking the second abnormal information corresponding to the determined lower-level item as the first abnormal information.
In this embodiment of the present invention, the exception configuration file includes one or more language versions, and the exception information determining module 303 is further configured to: determining the language of the code operating environment, determining the language version of the abnormal configuration file according to the language of the operating environment, and displaying the first abnormal information according to the determined language version.
In the embodiment of the invention, a plurality of abnormal configuration files are stored in the online server; the anomaly information determination module 303 is further configured to: and according to the first abnormal item, downloading an abnormal configuration file corresponding to the first abnormal item from the online server to the local, and according to the downloaded abnormal configuration file, determining first abnormal information corresponding to the first abnormal item.
In the embodiment of the invention, the abnormal configuration file is stored in an online server; the anomaly information determination module 303 is further configured to: according to the first abnormal item, acquiring a second abnormal item corresponding to the first abnormal item and second abnormal information corresponding to the second abnormal item from an abnormal configuration file of the online server; and generating and displaying the first abnormal information according to the second abnormal information.
In an embodiment of the present invention, the first exception information includes any one or more of: the method comprises the steps of exception encoding, exception description information in a plaintext form and an exception resolution strategy in the plaintext form.
According to the abnormal information display device of the code, disclosed by the embodiment of the invention, when the abnormal operation of the code is monitored, a first abnormal item of the code can be determined, first abnormal information corresponding to the first abnormal item is determined according to an abnormal configuration file, and the first abnormal information is displayed in a plaintext form; the abnormal configuration file comprises a plurality of second abnormal items and second abnormal information in a plaintext form corresponding to the second abnormal items respectively, so that the problem of the program is visually presented in the plaintext form, and the problem troubleshooting efficiency of developers is improved.
Fig. 4 shows an exemplary system architecture 400 of an exception information presentation method for a code or an exception information presentation apparatus for a code to which an embodiment of the present invention may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and an electronic device 405. The network 404 serves as a medium for providing communication links between the terminal devices 401, 402, 403 and the electronic device 405. Network 404 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 401, 402, 403 to interact with an electronic device 405 over a network 404 to receive or send messages or the like. The terminal devices 401, 402, 403 may have various communication client applications installed thereon, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, and the like.
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The electronic device 405 may be a server that provides various services, such as a background management server that supports shopping websites browsed by users using the terminal devices 401, 402, and 403. The background management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (e.g., target push information and product information) to the terminal device.
It should be noted that the method for displaying the exception information of the code provided by the embodiment of the present invention is generally executed by the electronic device 405, and accordingly, an apparatus for displaying the exception information of the code is generally disposed in the electronic device 405.
It should be understood that the number of terminal devices, networks, and electronic devices in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and electronic devices, as desired for implementation.
Referring now to FIG. 5, shown is a block diagram of a computer system 500 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU)501 that 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 section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 501.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor comprises a monitoring module, an abnormal item determining module, an abnormal information determining module and a display module. The names of these modules do not in some cases constitute a limitation on the module itself, for example, a listening module may also be described as a "module for listening for the execution of code".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: monitoring the running of the code; when the code runs abnormally, determining a first abnormal item of the code; determining first abnormal information corresponding to the first abnormal item according to the abnormal configuration file; the exception configuration file includes: second abnormal information in a plaintext form corresponding to the plurality of second abnormal items and the plurality of second abnormal items respectively; and displaying the first abnormal information in a plaintext form.
According to the technical scheme of the embodiment of the invention, when the code running is monitored to be abnormal, a first abnormal item of the code can be determined, first abnormal information corresponding to the first abnormal item is determined according to an abnormal configuration file, and the first abnormal information is displayed in a plaintext form; the abnormal configuration file comprises a plurality of second abnormal items and second abnormal information in a plaintext form corresponding to the second abnormal items respectively, so that the problem of the program is visually presented in the plaintext form, and the problem troubleshooting efficiency of developers is improved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (10)
1. A method for displaying abnormal information of a code is characterized by comprising the following steps:
monitoring the running of the code;
when the code runs abnormally, determining a first abnormal item of the code;
determining first abnormal information corresponding to the first abnormal item according to an abnormal configuration file; the exception profile includes: second abnormal information in a plaintext form corresponding to the plurality of second abnormal items and the plurality of second abnormal items respectively;
and displaying the first abnormal information in a plaintext form.
2. The method of claim 1, wherein the plurality of second exception items correspond to different hierarchical levels;
the determining first abnormal information corresponding to the first abnormal item includes:
according to the category to which the first abnormal item belongs, searching a second abnormal item of the highest level corresponding to the category in the abnormal configuration file;
and determining whether the second abnormal item of the highest level has a subordinate item, and if not, taking second abnormal information corresponding to the second abnormal item of the highest level as the first abnormal information.
3. The method of claim 2, wherein when it is determined that a subordinate item exists in the second abnormal item of the highest hierarchy level, the method further comprises:
determining a lower item corresponding to the first abnormal item in the lower items of the second abnormal item according to the abnormal field in the first abnormal item;
and taking the determined second abnormal information corresponding to the subordinate item as the first abnormal information.
4. The method of claim 1, wherein the exception profile includes one or more language versions, the method further comprising:
determining the language of the code operating environment, determining the language version of the abnormal configuration file according to the language of the operating environment, and displaying the first abnormal information according to the determined language version.
5. The method of claim 1, wherein the exception profile is multiple and the exception profile is stored on an online server;
after the determining the first exception entry for the code, comprising:
and according to the first abnormal item, downloading an abnormal configuration file corresponding to the first abnormal item from the online server to the local, and according to the downloaded abnormal configuration file, determining first abnormal information corresponding to the first abnormal item.
6. The method of claim 1, wherein the exception profile is stored on an online server;
after the determining the first exception entry for the code, comprising:
according to the first abnormal item, acquiring a second abnormal item corresponding to the first abnormal item and second abnormal information corresponding to the second abnormal item from an abnormal configuration file of the online server;
and generating and displaying the first abnormal information according to the second abnormal information.
7. The method according to any one of claims 1 to 6, wherein the first anomaly information includes any one or more of: the method comprises the steps of exception encoding, exception description information in a plaintext form and an exception resolution strategy in the plaintext form.
8. The device for displaying the abnormal information of the code is characterized by comprising a monitoring module, an abnormal item determining module, an abnormal information determining module and a displaying module; wherein:
the monitoring module is used for monitoring the running of the code;
the abnormal item determining module is used for determining a first abnormal item of the code when the code runs abnormally;
the abnormal information determining module is used for determining first abnormal information corresponding to the first abnormal item according to an abnormal configuration file; the exception profile includes: second abnormal information in a plaintext form corresponding to the plurality of second abnormal items and the plurality of second abnormal items respectively;
the display module is used for displaying the first abnormal information in a plaintext form.
9. An electronic device for displaying exception information of a code, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110018282.8A CN113760720A (en) | 2021-01-07 | 2021-01-07 | Code abnormal information display method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110018282.8A CN113760720A (en) | 2021-01-07 | 2021-01-07 | Code abnormal information display method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113760720A true CN113760720A (en) | 2021-12-07 |
Family
ID=78786262
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110018282.8A Pending CN113760720A (en) | 2021-01-07 | 2021-01-07 | Code abnormal information display method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113760720A (en) |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090228869A1 (en) * | 2008-03-05 | 2009-09-10 | Microsoft Corporation | Annotating exception information in a computer program |
CN103019874A (en) * | 2012-12-13 | 2013-04-03 | 中国电子科技集团公司第十五研究所 | Method and device for realizing exception handling based on data synchronization |
US9081595B1 (en) * | 2011-12-06 | 2015-07-14 | The Mathworks, Inc. | Displaying violated coding rules in source code |
CN105718369A (en) * | 2016-01-19 | 2016-06-29 | 国家电网公司 | Computer software test abnormity processing system and test method |
CN106874163A (en) * | 2016-12-29 | 2017-06-20 | 广州华多网络科技有限公司 | A kind of method and system for showing software error code information |
US20170212826A1 (en) * | 2016-01-26 | 2017-07-27 | International Business Machines Corporation | Exception prediction before an actual exception during debugging |
CN108446185A (en) * | 2018-03-27 | 2018-08-24 | 武汉斗鱼网络科技有限公司 | Abnormality eliminating method, device, electric terminal and readable storage medium storing program for executing |
CN109376025A (en) * | 2018-09-03 | 2019-02-22 | 平安普惠企业管理有限公司 | Abnormality eliminating method, device, computer equipment and storage medium |
CN110196790A (en) * | 2018-02-24 | 2019-09-03 | 北京京东尚科信息技术有限公司 | The method and apparatus of abnormal monitoring |
US20190294796A1 (en) * | 2018-03-23 | 2019-09-26 | Microsoft Technology Licensing, Llc | Resolving anomalies for network applications using code injection |
CN111984444A (en) * | 2020-07-24 | 2020-11-24 | 五八有限公司 | Abnormal information processing method and device |
-
2021
- 2021-01-07 CN CN202110018282.8A patent/CN113760720A/en active Pending
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090228869A1 (en) * | 2008-03-05 | 2009-09-10 | Microsoft Corporation | Annotating exception information in a computer program |
US9081595B1 (en) * | 2011-12-06 | 2015-07-14 | The Mathworks, Inc. | Displaying violated coding rules in source code |
CN103019874A (en) * | 2012-12-13 | 2013-04-03 | 中国电子科技集团公司第十五研究所 | Method and device for realizing exception handling based on data synchronization |
CN105718369A (en) * | 2016-01-19 | 2016-06-29 | 国家电网公司 | Computer software test abnormity processing system and test method |
US20170212826A1 (en) * | 2016-01-26 | 2017-07-27 | International Business Machines Corporation | Exception prediction before an actual exception during debugging |
CN106874163A (en) * | 2016-12-29 | 2017-06-20 | 广州华多网络科技有限公司 | A kind of method and system for showing software error code information |
CN110196790A (en) * | 2018-02-24 | 2019-09-03 | 北京京东尚科信息技术有限公司 | The method and apparatus of abnormal monitoring |
US20190294796A1 (en) * | 2018-03-23 | 2019-09-26 | Microsoft Technology Licensing, Llc | Resolving anomalies for network applications using code injection |
CN108446185A (en) * | 2018-03-27 | 2018-08-24 | 武汉斗鱼网络科技有限公司 | Abnormality eliminating method, device, electric terminal and readable storage medium storing program for executing |
CN109376025A (en) * | 2018-09-03 | 2019-02-22 | 平安普惠企业管理有限公司 | Abnormality eliminating method, device, computer equipment and storage medium |
CN111984444A (en) * | 2020-07-24 | 2020-11-24 | 五八有限公司 | Abnormal information processing method and device |
Non-Patent Citations (3)
Title |
---|
张语涵;刘淑华;周永鑫;: "Java Web应用中错误和异常处理方法研究", 现代计算机(专业版), no. 23, 15 August 2013 (2013-08-15), pages 63 - 67 * |
李宁, 张云云: "基于.NET的一种异常管理模型", 西安科技学院学报, no. 04, 30 December 2004 (2004-12-30), pages 116 - 120 * |
王旭;: "Java中异常处理机制的发展过程", 信息与电脑(理论版), no. 07, 15 July 2012 (2012-07-15), pages 111 - 112 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107491488B (en) | Page data acquisition method and device | |
CN108920222B (en) | Business processing method and device based on rule engine | |
CN111190888A (en) | Method and device for managing graph database cluster | |
CN111090423B (en) | Webhook framework system and method for realizing active calling and event triggering | |
CN111427701A (en) | Workflow engine system and business processing method | |
US9374417B1 (en) | Dynamic specification auditing for a distributed system | |
CN108108986B (en) | Design method and device of customer relationship management system and electronic equipment | |
CN113760324A (en) | Method and device for constructing micro front-end application | |
CN112596854A (en) | Method and device for continuously integrating running of assembly line | |
CN115470432A (en) | Page rendering method and device, electronic equipment and computer readable medium | |
CN105094857B (en) | Method and system for application load | |
CN114185734A (en) | Cluster monitoring method and device and electronic equipment | |
CN117873597A (en) | Method and system for realizing API arrangement through visual configuration mode | |
CN112130888B (en) | Method, device, equipment and computer storage medium for updating application program | |
CN110795135A (en) | Method and device for realizing injection-resolution configuration | |
CN112764746B (en) | Data processing method, device, electronic equipment and storage medium | |
CN112650804A (en) | Big data access method, device, system and storage medium | |
CN111414154A (en) | Method and device for front-end development, electronic equipment and storage medium | |
CN113760720A (en) | Code abnormal information display method and device | |
CN112306723B (en) | Operation information acquisition method and device applied to applet | |
CN114489674A (en) | Data verification method and device of dynamic data model | |
CN113762910A (en) | Document monitoring method and device | |
CN112463616A (en) | Chaos testing method and device for Kubernetes container platform | |
US10558487B2 (en) | Dynamic customization of client behavior | |
CN113971060B (en) | Interface display method, device, electronic equipment and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |