Exception handling method and device, storage medium and program product
By receiving exception stack information, quickly locate and push exception prompt information to the submission user of the exception code, the problem of difficult positioning of exception code in the software is solved, and the processing efficiency and software stability are improved.
Patent Information
- Application Number
- CN202510545602.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-27
- Publication Date
- 2025-08-08
AI Technical Summary
In the prior art, exception codes are difficult to quickly locate and process during software operation, resulting in the impact of software stability and user experience.
By receiving the exception stack information reported by the front-end, determine the target source code file and number of lines to which the exception code belongs, and use the pre-stored code to submit information to quickly locate the user of the exception code and push the exception prompt information to it.
It realizes rapid positioning and processing of exception codes, improves the positioning and subsequent processing efficiency of exception codes, reduces processing time, and improves the stability and user experience of the software.
Smart Images

Figure CN120448172A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of this specification relate to the field of software engineering technology, and in particular, to an exception handling method, device, storage medium, and program product. Background Art
[0002] With the rapid development of information technology, software has become increasingly diverse, encompassing a wide range of programs, from simple applications to complex systems. Whether it's mobile apps, web systems, or enterprise-level software, various code issues may arise during operation. Therefore, abnormal code detection has become increasingly important. Abnormal code detection can promptly identify errors or vulnerabilities in program code, minimizing software crashes and malfunctions, and ensuring software stability and high-quality operation.
[0003] However, as the scale of software code continues to expand, the number of lines of program code increases, and the structure of program code becomes more and more complex, which brings great challenges to the location and subsequent processing of abnormal code. Summary of the Invention
[0004] In view of this, one or more embodiments of this specification provide the following technical solutions:
[0005] According to a first aspect of one or more embodiments of this specification, a method for handling an exception is provided, the method comprising:
[0006] In response to receiving the exception stack information reported by the front end, based on the exception stack information, determining the target source code file to which the exception code belongs, and determining the line number of the exception code in the target source code file;
[0007] Determining a user who submitted the abnormal code based on the target source code file, the number of lines of the abnormal code in the target source code file, and pre-stored code submission information; wherein the code submission information is used to indicate an association between the source code file and a submission identifier, and the submission identifier is used to at least identify the user who submitted different lines of code in the source code file;
[0008] Push exception prompt information to the user who submitted the exception code.
[0009] According to a second aspect of one or more embodiments of this specification, an exception handling device is provided, the device comprising:
[0010] a determination module configured to, in response to receiving the exception stack information reported by the front end, determine the target source code file to which the exception code belongs based on the exception stack information, and determine the number of lines of the exception code in the target source code file;
[0011] The determination module is further configured to determine a user who submitted the abnormal code based on the target source code file, the number of lines of the abnormal code in the target source code file, and pre-stored code submission information; wherein the code submission information is used to indicate an association between the source code file and the submission identifier, and the submission identifier is used to at least identify the user who submitted different lines of code in the source code file;
[0012] The push module is used to push the exception prompt information to the user who submitted the exception code.
[0013] According to a third aspect of one or more embodiments of this specification, an electronic device is proposed, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor implements the steps of the exception handling method described in the first aspect above by running the executable instructions.
[0014] According to a fourth aspect of one or more embodiments of this specification, a computer-readable storage medium is provided, on which computer instructions are stored. When the computer instructions are executed by a processor, the steps of the exception handling method described in the first aspect are implemented.
[0015] According to a fifth aspect of one or more embodiments of this specification, a computer program product is proposed, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the exception handling method described in the first aspect above.
[0016] As can be seen from the above embodiments, this specification determines the target source code file to which the exception code belongs based on the received exception stack information when the front end receives the exception stack information reported by the front end, and determines the number of lines of the exception code in the target source code file, so as to determine the submitting user of the exception code based on the target source code file, the number of lines of the exception code in the target source code file, and the association between the source code file and the submission identifier of the submitting user used to identify different lines of code in the source code file, so that the exception prompt information can be directly pushed to the submitting user of the exception code. Through the solution provided by this specification, the location of the exception code and the determination of the submitting user of the exception code can be quickly achieved when the exception stack information reported by the front end is received, and the exception prompt information can be directly pushed to the corresponding code submitting user, thereby improving the efficiency of the location of the exception code and the subsequent processing process. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is a schematic diagram of an application scenario of an exception handling method provided by an exemplary embodiment.
[0018] Figure 2 This is a flowchart of an exception handling method provided by an exemplary embodiment.
[0019] Figure 3 It is a flowchart of a closed-loop solution for abnormality location and processing provided by an exemplary embodiment.
[0020] Figure 4 This is a schematic structural diagram of an electronic device provided by an exemplary embodiment.
[0021] Figure 5 It is a block diagram of an exception handling device provided by an exemplary embodiment. DETAILED DESCRIPTION
[0022] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The implementations described in the following exemplary embodiments are not intended to represent all implementations consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with certain aspects of one or more embodiments of this specification, as detailed in the appended claims.
[0023] It should be noted that in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or fewer steps than those described in this specification. In addition, a single step described in this specification may be broken down into multiple steps for description in other embodiments, and multiple steps described in this specification may be combined into a single step for description in other embodiments.
[0024] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.
[0025] In related technologies, abnormal code detection plays a crucial role in software operation. While abnormal code detection can help identify potential code errors and issues early during the software development phase, even comprehensive code testing during development can still cause code anomalies after deployment in a live environment. Therefore, on-device anomaly detection has become a crucial step in ensuring user experience and stable system operation.
[0026] While the software is running on the front end, real-time monitoring and analysis of the software's running status can be used to quickly discover and handle problems such as program crashes and decreased program performance, and provide timely feedback to the development team so that the development team can make timely repairs to avoid affecting the user experience.
[0027] While the software is running on the frontend, the stack can record various information related to function calls and program execution status, including but not limited to function parameters, function local variables, function call return addresses, program execution status, and program execution context. As a key mechanism for managing program execution, the stack helps programs track function call status during execution (especially function calls).
[0028] In some embodiments, when an exception occurs during program execution, a snapshot of the current stack state can be taken to generate exception stack information that can display the execution context when the exception occurs. The front end can report the exception stack information to the back-end electronic device so that the electronic device can implement exception detection and processing based on the received exception stack information.
[0029] However, in the related art, there is no solution that can quickly locate the user who submitted the exception code for exception detection and processing based on exception stack information. In view of this, this specification hopes to provide an exception handling method that can quickly locate the user who submitted the exception code when receiving the exception stack information and push exception prompt information to him / her in a timely manner.
[0030] See also Figure 1 , Figure 1 This is a schematic diagram of an application scenario of an exception handling method provided by an exemplary embodiment. Figure 1 As shown, the application scenario can be composed of a terminal device 101 serving as the front end for software operation and an electronic device 102 providing background support, wherein the terminal device 101 and the electronic device 102 can interact with each other through wired or wireless communication, and one or more embodiments of this specification do not limit this.
[0031] In some embodiments, the terminal device 101 can be a desktop computer, a personal computer (PC), a mobile phone, a tablet computer, a laptop computer, a personal digital assistant (PDA), a wearable device (such as smart glasses, smart watches, etc.), etc., and one or more embodiments of this specification are not limited to this.
[0032] In some embodiments, the electronic device 102 may be a physical server including an independent host or a virtual server hosted by a host cluster, or the electronic device 102 may also be a terminal device connected to a background server via a wired or wireless connection, but is not limited thereto.
[0033] In some embodiments, developers can compile application program code through electronic device 102 and package the compiled program code with resource files (including but not limited to layout files, runtime environment configuration files, etc.) into an application package to publish the packaged application package. Application users can obtain the published application package through terminal device 101 and install the application package on terminal device 101 to install the application so that the installed application can be run on terminal device 101.
[0034] In some embodiments, the application package can be marked with an application package version number when it is released, which is used to identify a specific version of the application to help developers, publishing platforms and application users to distinguish different versions of the application, track the update history of the application, and ensure that the correct version of the application is installed and run.
[0035] In some embodiments, developers can also update the program code of the application through the electronic device 102, and package the updated program code and resource files into a new application package, so as to publish the new application package with a new application package version number.
[0036] Optionally, the application package may be a Java Archive (jar) package, but is not limited thereto.
[0037] It should be noted that no matter which version of the application is used, program code execution errors may occur during its operation. When an error occurs in the program code execution, the terminal device 101 as the front-end can report the exception stack information to the electronic device 102. The electronic device 102 can use the exception handling method provided in one or more embodiments of this specification to quickly locate the user who submitted the exception code and push exception prompt information to the exception user in a timely manner.
[0038] Optionally, the above application can be run in an Android system, but is not limited thereto, and the above application can also be run in other operating systems.
[0039] Optionally, the above-mentioned applications can be of various types, including but not limited to social media applications, communication applications, education applications, financial payment applications, shopping applications, travel applications, payment applications, image processing applications, security and privacy protection applications, utility applications, etc.
[0040] The above is merely an illustrative description of the application scenarios of one or more embodiments of this specification and does not constitute a limitation on the application scenarios of the embodiments of this specification. In more possible implementations, the solutions provided by one or more embodiments of this specification can be applied to more scenarios involving abnormalities in the operation of applications. One or more embodiments of this specification do not limit the specific application scenarios.
[0041] After introducing the application scenarios of one or more embodiments of this specification, the optional implementation process of one or more embodiments of this specification will be introduced next.
[0042] See also Figure 2 , Figure 2 This is a flowchart of an exception handling method provided by an exemplary embodiment. Figure 2 As shown, the method includes:
[0043] Step 201 : In response to receiving the exception stack information reported by the front end, based on the exception stack information, determine the target source code file to which the exception code belongs, and determine the number of lines of the exception code in the target source code file.
[0044] In some embodiments, the exception stack information may be information automatically generated by the application when an exception occurs during application execution, and is used to record the application version where the exception occurred and the state of the application call stack when the exception occurred, which can help track and locate the location where the application exception occurred.
[0045] In some embodiments, the source code file where the exception occurs (referred to as the target source code file) can be located based on the exception stack information, and the line number of the exception code in the target source code file can be further determined.
[0046] Step 202: Determine the user who submitted the abnormal code based on the target source code file, the number of lines of the abnormal code in the target source code file, and pre-stored code submission information; wherein the code submission information is used to indicate the association between the source code file and the submission identifier, and the submission identifier is used to at least identify the user who submitted different lines of code in the source code file.
[0047] In some embodiments, code submission information may be used to indicate the association between a source code file and a commit ID (commitID), which may be recorded and stored when the application package is packaged. The commit ID may be used to identify the user who submitted different lines of code in the source code file when the application package is packaged, but is not limited thereto.
[0048] In some embodiments, the submission identifier corresponding to the target source code file can be determined based on the target source code file and pre-stored code submission information, and then the submitting user who submitted the abnormal code when packaging the application package can be determined based on the determined submission identifier and the number of lines of the abnormal code in the target source code file.
[0049] Step 203: Push exception prompt information to the user who submitted the exception code.
[0050] In some embodiments, the exception prompt information may be used to prompt the user who submitted the abnormal code to repair the abnormal code, but is not limited thereto.
[0051] Through the solution provided by the above embodiment, the exception code can be quickly located and the user who submitted the exception code can be determined when the exception stack information reported by the front end is received, and the exception prompt information can be directly pushed to the corresponding code submitting user, thereby improving the efficiency of the exception code location and subsequent processing process.
[0052] After introducing the basic implementation of the exception handling method provided by one or more embodiments of this specification, the optional implementation of one or more embodiments of this specification is introduced below.
[0053] In some embodiments, step 201 can be implemented by determining the target source code file to which the exception code belongs based on the exception stack information and determining the line number of the exception code in the target source code file through the following steps:
[0054] Step 2011: Determine the application package version corresponding to the exception code based on the exception stack information.
[0055] Optionally, the exception stack information may carry the application version corresponding to the exception code. Different versions of the application may correspond to different versions of the application package. Moreover, the application package versions corresponding to the different versions of the application have been recorded when the application package is packaged. Therefore, in some embodiments, when determining the application package version corresponding to the exception code based on the exception stack information, it can be achieved in the following manner:
[0056] Obtain the application version carried in the exception stack information, and based on the application version carried in the exception stack information, determine the application package version corresponding to the application version as the application package version corresponding to the exception code. Step 2012: Based on the application package version, determine the source code file corresponding to the application package indicated by the application package version as the target source code file.
[0057] It should be noted that the component versions referenced by different versions of application packages are fixed and can be determined based on the stack information. In addition, the code library branches corresponding to different versions of components are also fixed and recorded when the application package is packaged. Based on the component version and code library branch, the specific source code file in the package can be located. Therefore, in some embodiments, when determining the target source code file based on the application package version, this can be achieved through the following steps:
[0058] Step 2012A: Based on the application package version, determine the component version referenced by the application package indicated by the application package version and the corresponding code library branch.
[0059] Optionally, the component version and code base branch referenced by the application package indicated by the application package version may be determined directly based on information recorded when the application is packaged.
[0060] Step 2012B: Based on the component version referenced by the application package and the corresponding code library branch, determine the source code file corresponding to the application package indicated by the application package version as the target source code file.
[0061] Optionally, a unique source code file can be located according to the component version referenced by the application package and the corresponding code library branch, and the source code file is the target source code file.
[0062] It should be noted that, in the process of determining the component version referenced by the current version of the application package based on the stack information, the full path name of the exception code can be extracted based on the exception code (i.e., the key stack line). Since the other jar packages (including but not limited to component packages) referenced by the application package are already determined when the application package is packaged, the other jar packages can be decompressed to traverse and store the relationship between the class full path names and packages in the other jar packages. The full path name of the exception code can be compared with the class full path name, and the component package corresponding to the class full path name that matches the full path name of the exception code can be used as the component package referenced by the current version of the application package, thereby determining the component version referenced by the current version of the application package.
[0063] Step 2013: Obtain the corresponding program structure symbol and the code whose location satisfies the conditions from the stack indicated by the exception stack information as the exception code, and determine the line number of the exception code in the target source code file.
[0064] In some embodiments, the corresponding program structure and location both meet the conditions, and the corresponding program structure symbol can be a specified program structure symbol and the location is the top layer of the code of the specified program structure symbol in the stack. Optionally, the program structure symbol can include a class name and / or a method name, but is not limited thereto.
[0065] In some embodiments, when obtaining the corresponding program structure symbol and the code at the location that meets the conditions from the stack indicated by the exception stack information as the exception code, it can be achieved by extracting the key stack line. Generally speaking, the key stack line is the top line of the stack, or the full path line of the code belonging to the business code library from top to bottom. That is to say, the code execution records stored in the stack can be searched in a retrieval order from top to bottom to find the code in the code execution record whose corresponding program structure symbol and the location that meet the conditions, and use it as the exception code.
[0066] In some embodiments, when searching the code execution records stored in the stack in a top-down order, if the corresponding program structure symbol of the code at the top of the stack indicated by the exception stack information is the specified program structure symbol, the code corresponding to the execution record at the top can be directly obtained as the exception code. Otherwise, if the corresponding program structure symbol of the code at the top of the stack indicated by the exception stack information is not the specified program structure symbol, it is necessary to continue searching downward until the first code whose corresponding program structure symbol is the specified program structure symbol is found as the exception code.
[0067] For example, if the program structure symbol is specified as program structure symbol 1, you can first determine whether the program structure symbol of the code corresponding to the code execution record at the top of the stack is program structure symbol 1. If so, you can directly obtain the code corresponding to the code execution record at the top of the stack as the exception code. If not, continue to determine whether the program structure symbol of the code corresponding to the code execution record at the second layer of the stack is program structure symbol 1. If so, you can use the code corresponding to the code execution record at the second layer of the stack as the exception code. If not, you need to continue searching to the third layer, and so on, until you find the first code in the code execution record recorded in the stack whose corresponding program structure symbol is program structure symbol 1 as the exception code.
[0068] As mentioned above, program structure symbols may include class names and / or method names, but are not limited thereto.
[0069] It should be noted that, for the purpose of code protection and preventing code cracking, code can be obfuscated during the code release phase to ensure that the code released to users is obfuscated and cannot be easily obtained, copied, or tampered with by others. For example, code obfuscation can be performed when packaging the application package, but is not limited to this.
[0070] Therefore, in some embodiments, before obtaining the corresponding program structure symbol and the code whose location meets the conditions from the stack indicated by the exception stack information as the exception code, the code in the stack indicated by the exception stack information can also be deobfuscated and parsed to achieve code restoration.
[0071] For example, when packaging an application package, code such as com.abcdef.reading.comment.replyBO may be obfuscated into com.abcdef.abc. Then, before searching for the exception code in the stack, the obfuscated code com.abcdef.abc may be restored to search for the exception code based on the restored code.
[0072] In some embodiments, after the exception code is determined from the stack indicated by the exception stack information, the determined exception code can be used as a search basis to determine the line number where the exception code is located in the target source code file.
[0073] In some embodiments, after determining the target source code file and the number of lines of the abnormal code in the target source code file through step 201, the user who submitted the abnormal code can be determined through step 202 based on the target source code file, the number of lines of the abnormal code in the target source code file, and pre-stored code submission information.
[0074] In some embodiments, step 202 may be implemented by the following steps when determining the user who submitted the abnormal code based on the target source code file, the number of lines of the abnormal code in the target source code file, and pre-stored code submission information:
[0075] Step 2021: Determine the submission identifier corresponding to the target source code file based on the target source code file and the code submission information.
[0076] Among them, the code submission information can be recorded and stored when the application package is integrated and packaged, and it can be used to indicate the association between the source code file and the submission identifier. As mentioned above, the target source code file can be determined based on the component version referenced by the package version and the corresponding code library branch. That is to say, the component version and the code library branch can correspond to a unique target source code file. Therefore, the code submission information can be used to indicate the association between the component version, the code library branch and the submission identifier, but is not limited to this. The code submission information can also be used to indicate the association between more types of information. For example, the code submission information can be used to indicate the association between the application package version, the component version, the code library branch and the submission identifier.
[0077] In some embodiments, when determining the submission identifier corresponding to the target source code file based on the target source code file and the code submission information, the submission identifier associated with the component version corresponding to the abnormal code and the code library branch can be determined based on the association relationship between the component version, the code library branch and the submission identifier indicated by the code submission information, so as to use the determined submission identifier as the submission identifier corresponding to the target source code file.
[0078] Step 2022: Based on the submission identifier corresponding to the target source code file, determine the package status information corresponding to the target source code file. The package status information is used to indicate the relevant submission record of the application package corresponding to the target source code file during packaging.
[0079] It should be noted that the commit identifier can be used to identify each code submission operation. For example, the commit identifier can be used to identify each code submission operation in a version control system (such as Git). Optionally, a unique identifier (i.e., the commit identifier) can be generated each time the code is submitted to identify and track the version of each code submission. In addition, the commit identifier can also be associated with the submission details of each submission, where the submission details can at least include, but are not limited to, the package status information of the application package at the time of submission.
[0080] In some embodiments, after determining the submission identifier corresponding to the target source code file, the package status information associated with the code submission operation identified by the submission identifier can be obtained as the package status information corresponding to the target source code file.
[0081] Optionally, the package status information may be used to indicate relevant submission records of the application package corresponding to the target source code file when it is packaged, including but not limited to the submission user and submission time of each line of code of the application package corresponding to the target source code file when it is packaged.
[0082] Step 2023: Determine the user who submitted the abnormal code based on the package status information corresponding to the target source code file and the number of lines of the abnormal code in the target source code file.
[0083] In some embodiments, after obtaining the package status information corresponding to the target source code file, the submitting user corresponding to each line of code in the target source code file can be known, and thus the submitting user corresponding to the line of code can be known based on the number of lines of the exception code in the target source code file, which is the submitting user who submitted the exception code when the application package was packaged.
[0084] Through the above embodiment, the user who submitted the abnormal code can be directly located when the abnormal stack information reported by the front end is received, so that the abnormal prompt information can be pushed to the user who submitted the abnormal code through step 203. Optionally, the abnormal prompt information can be used to prompt the submitting user that the submitted code has an abnormality. Furthermore, the abnormal prompt information can also indicate the specific content and / or line number of the abnormal code to ensure that the submitting user can quickly know which line of code submitted by the user has an abnormality, so that the corresponding abnormal code can be repaired in time.
[0085] In some embodiments, after the submitting user of the abnormal code is determined through step 202, operation prompt information for the abnormal code can also be automatically generated to push the operation prompt information to the submitting user of the abnormal code, wherein the operation prompt information can be used to indicate the recommended repair solution for the abnormal code so that the submitting user can quickly implement the repair of the abnormal code.
[0086] In some embodiments, when generating operation prompt information for an abnormal code, it can be implemented through an artificial intelligence processing solution based on big data. For example, the operation prompt information for the abnormal code can be generated through a content generation model, that is, the abnormal code can be used as an input to the content generation model to output the operation prompt information for the abnormal code through the content generation model, wherein the content generation model can be an artificial intelligence generated content (AIGC) model based on big data, but is not limited to this.
[0087] Optionally, the content generation model can be trained based on a variety of abnormal codes and code repair solutions used in the past, and can provide recommended code repair solutions for various types of abnormal codes.
[0088] The repair solution for the abnormal code may be a new code modified based on the abnormal code, that is, the operation prompt information may be used to indicate the code modified based on the abnormal code.
[0089] In some embodiments, the operation prompt information may also provide a code submission entry, which can be used to replace the abnormal code with the code indicated by the operation prompt information after being triggered. In other words, the code submission entry can provide a quick entry for submitting the repair code in one click.
[0090] According to the solution provided by one or more embodiments of this specification, a closed-loop solution can be provided that can quickly locate abnormal codes and provide processing suggestions, so as to improve the timeliness of locating abnormal problems on the terminal, thereby quickly pushing code problems to the code submitter, and providing a quick solution for handling problems with one click, thereby reducing the time required for exception handling and improving exception handling efficiency.
[0091] See also Figure 3 , Figure 3 FIG. 1 is a flow chart of a closed-loop solution for abnormal location and processing provided by an exemplary embodiment. Figure 3 As shown, the method may include the following steps:
[0092] Step 301: Receive exception stack information reported by the front end.
[0093] Step 302: Perform deobfuscation analysis based on the received exception stack information.
[0094] Step 303: Determine the application package version and extract the exception code.
[0095] It's important to note that the exception code is also known as the key stack line, which is generally the top line of the stack, or the full path of code from the top down that belongs to the business code base. The application package version can be directly determined based on the exception stack information reported by the front-end. For example, the exception stack information reported by the front-end may include the application version. Based on the application version, the application package version corresponding to the app that reported the exception can be determined.
[0096] Step 304: Determine the number of lines of the abnormal code in the corresponding code file.
[0097] It should be noted that when the application is packaged, the component version it references is determined. The code library branch corresponding to the component version referenced by the application package can be found, and the code file where the exception occurs can be determined based on the component version and the code library branch referenced by the package version; and, based on the exception stack information, key code lines can be extracted in the corresponding stack to obtain the exception code, so that the line number where the exception code is located can be found in the code file that sent the exception based on the extracted exception code.
[0098] Step 305: Find the corresponding submitting user through the component version, code base branch, submission identifier, and number of lines of abnormal code.
[0099] Optionally, the association relationship between the component version, the code base branch, and the submission identifier may be stored when the application is packaged.
[0100] It should be noted that when the application is packaged, the component version it references is determined. The code base branch corresponding to the component version referenced by the application package can be found through the component version referenced by the application package. The git repository organizes and manages the code according to the component version and the code base branch, so it is necessary to search for the commitID based on the component version and the code base branch so that the package status information at the time of packaging can be found based on the commit ID. The package status information will record the commit information corresponding to different lines of code (such as the submitting user), so that the corresponding submitting user can be found based on the number of lines of abnormal code.
[0101] Step 306: Push the abnormal prompt information to the corresponding submitting user.
[0102] Optionally, the exception prompt information pushed to the submitting user can indicate the component version and code library branch where the exception occurred, as well as the number of code lines, so that the submitting user can determine the source code file to which the abnormal code belongs based on the component version and code library branch, and determine the specific location of the abnormal code based on the number of code lines.
[0103] Step 307: Provide a solution to the abnormal problem through the content generation model and provide a quick entry for submitting the code in one click.
[0104] It should be noted that Figure 3 The illustrated embodiments only introduce the general process of one or more embodiments of this specification. The detailed implementation process can be found in the previous description and will not be repeated here.
[0105] Corresponding to the aforementioned method embodiments, this specification also provides corresponding device embodiments and apparatus embodiments.
[0106] Figure 4 This is a schematic structural diagram of an electronic device provided by an exemplary embodiment. Figure 4At the hardware level, the device includes a processor 402, an internal bus 404, a network interface 406, a memory 408, and a non-volatile memory 410. Of course, it may also include hardware required for other functions. One or more embodiments of this specification can be implemented based on software, such as the processor 402 reading the corresponding computer program from the non-volatile memory 410 into the memory 408 and then running it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0107] One or more embodiments of this specification also provide an exception handling device, please refer to Figure 5 , Figure 5 This is a block diagram of an exception handling device provided by an exemplary embodiment. The exception handling device can be applied to Figure 4 In the electronic device shown in FIG. , the technical solution of this specification is implemented. The exception handling device may include:
[0108] Determining module 501, configured to, in response to receiving the exception stack information reported by the front end, determine the target source code file to which the exception code belongs based on the exception stack information, and determine the number of lines of the exception code in the target source code file;
[0109] The determining module 501 is further configured to determine a user who submitted the abnormal code based on the target source code file, the number of lines of the abnormal code in the target source code file, and pre-stored code submission information; wherein the code submission information is used to indicate an association between the source code file and a submission identifier, and the submission identifier is used to at least identify the user who submitted different lines of code in the source code file;
[0110] The push module 502 is used to push the exception prompt information to the user who submitted the exception code.
[0111] In some embodiments, the determining module 501, when used to determine the target source code file to which the exception code belongs based on the exception stack information, and to determine the number of lines of the exception code in the target source code file, is used to:
[0112] Determining the application package version corresponding to the exception code based on the exception stack information;
[0113] Based on the application package version, determining a source code file corresponding to the application package indicated by the application package version as the target source code file;
[0114] The corresponding program structure symbol and the code whose location satisfies the conditions are obtained from the stack indicated by the exception stack information as the exception code, and the number of lines of the exception code in the target source code file is determined.
[0115] In some embodiments, the determining module 501, when used to determine, based on the application package version, a source code file corresponding to the application package indicated by the application package version as the target source code file, is used to:
[0116] Based on the application package version, determining a component version referenced by the application package indicated by the application package version and a corresponding code library branch;
[0117] Based on the component version referenced by the application package and the corresponding code library branch, a source code file corresponding to the application package indicated by the application package version is determined as the target source code file.
[0118] In some embodiments, the determining module 501, when used to obtain, from the stack indicated by the exception stack information, a code whose corresponding program structure symbol and location both meet the conditions as the exception code, is used for any of the following:
[0119] If the program structure symbol corresponding to the code at the top layer in the stack indicated by the exception stack information is a specified program structure symbol, obtaining the code at the top layer as the exception code;
[0120] If the program structure symbol corresponding to the code at the top layer in the stack indicated by the exception stack information is not the specified program structure symbol, continue searching downward until the first code whose program structure symbol is the specified program structure symbol is found as the exception code;
[0121] The program structure symbols include class names and / or method names.
[0122] In some embodiments, the determining module 501, when used to determine the user who submitted the abnormal code based on the target source code file, the number of lines of the abnormal code in the target source code file, and pre-stored code submission information, is used to:
[0123] Determining a submission identifier corresponding to the target source code file based on the target source code file and the code submission information;
[0124] Determining, based on a submission identifier corresponding to the target source code file, package status information corresponding to the target source code file, wherein the package status information is used to indicate a relevant submission record of an application package corresponding to the target source code file during packaging;
[0125] A user who submitted the abnormal code is determined based on the package status information corresponding to the target source code file and the number of lines of the abnormal code in the target source code file.
[0126] In some embodiments, the code submission information is used to indicate the association relationship between the source code file and the submission identifier, including:
[0127] The code submission information is used to indicate the association relationship between the component version, the code library branch and the submission identifier, wherein the component version and the code library branch correspond to the target source code file;
[0128] The determining module 501, when used to determine the submission identifier corresponding to the target source code file based on the target source code file and the code submission information, is used to:
[0129] Based on the component version and the code library branch, a commit identifier corresponding to the target source code file is determined.
[0130] In some embodiments, the exception handling device further includes:
[0131] A generation module, configured to generate operation prompt information for the abnormal code by using a content generation model, wherein the operation prompt information is used to indicate a repair solution for the abnormal code;
[0132] The push module 502 is further configured to push the operation prompt information to the user who submitted the abnormal code.
[0133] In some embodiments, the operation prompt information is used to indicate a repair solution for the abnormal code, including: the operation prompt information is used to indicate a code modified based on the abnormal code;
[0134] The operation prompt information is further used to provide a code submission entry, and the code submission entry is used to replace the abnormal code with the code indicated by the operation prompt information after being triggered.
[0135] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email transceiver, game console, tablet computer, wearable device, or any combination of these devices.
[0136] In a typical configuration, a computer includes one or more processors (Central Processing Unit, CPU), input / output interfaces, network interfaces and memory.
[0137] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0138] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change random access memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. According to the definition in this article, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0139] In some embodiments, this specification also provides a computer program product, including a computer program, which implements the exception handling method provided in any embodiment of this specification when executed by a processor of a computing device.
[0140] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0141] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0142] The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms "a," "an," "the," and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0143] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when..." or "when..." or "in response to determining."
[0144] The above description is merely a preferred embodiment of one or more embodiments of this specification and is not intended to limit one or more embodiments of this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of this specification shall be included in the scope of protection of one or more embodiments of this specification.
Claims
1. A method for handling an exception, the method comprising: In response to receiving the exception stack information reported by the front end, based on the exception stack information, determining the target source code file to which the exception code belongs, and determining the line number of the exception code in the target source code file; Determining a user who submitted the abnormal code based on the target source code file, the number of lines of the abnormal code in the target source code file, and pre-stored code submission information; wherein the code submission information is used to indicate an association between the source code file and a submission identifier, and the submission identifier is used to at least identify the user who submitted different lines of code in the source code file; Push exception prompt information to the user who submitted the exception code.
2. The method according to claim 1, wherein determining the target source code file to which the exception code belongs based on the exception stack information and determining the number of lines of the exception code in the target source code file comprises: Determining the application package version corresponding to the exception code based on the exception stack information; Based on the application package version, determining a source code file corresponding to the application package indicated by the application package version as the target source code file; The code whose corresponding program structure symbol and location meet the conditions is obtained from the stack indicated by the exception stack information as the exception code, and the number of lines of the exception code in the target source code file is determined.
3. The method according to claim 2, wherein the determining, based on the application package version, a source code file corresponding to the application package indicated by the application package version as the target source code file comprises: Based on the application package version, determining a component version referenced by the application package indicated by the application package version and a corresponding code library branch; Based on the component version referenced by the application package and the corresponding code library branch, a source code file corresponding to the application package indicated by the application package version is determined as the target source code file.
4. The method according to claim 2, wherein the step of obtaining, from the stack indicated by the exception stack information, a code whose corresponding program structure symbol and location satisfy conditions as the exception code comprises any one of the following: If the program structure symbol corresponding to the code at the top layer in the stack indicated by the exception stack information is a specified program structure symbol, obtaining the code at the top layer as the exception code; If the program structure symbol corresponding to the code at the top layer in the stack indicated by the exception stack information is not the specified program structure symbol, continue searching downward until the first code whose program structure symbol is the specified program structure symbol is found as the exception code; in, The program structure symbol includes a class name and / or a method name.
5. The method according to claim 1 , wherein determining the user who submitted the abnormal code based on the target source code file, the number of lines of the abnormal code in the target source code file, and pre-stored code submission information comprises: Determining a submission identifier corresponding to the target source code file based on the target source code file and the code submission information; Determining, based on a submission identifier corresponding to the target source code file, package status information corresponding to the target source code file, wherein the package status information is used to indicate a relevant submission record of an application package corresponding to the target source code file during packaging; A user who submitted the abnormal code is determined based on the package status information corresponding to the target source code file and the number of lines of the abnormal code in the target source code file.
6. The method according to claim 5, wherein the code submission information is used to indicate the association relationship between the source code file and the submission identifier, including: The code submission information is used to indicate the association relationship between the component version, the code library branch and the submission identifier, wherein the component version and the code library branch correspond to the target source code file; The determining, based on the target source code file and the code submission information, a submission identifier corresponding to the target source code file includes: Based on the component version and the code library branch, a commit identifier corresponding to the target source code file is determined.
7. The method according to claim 1, after determining the user who submitted the abnormal code based on the target source code file, the number of lines of the abnormal code in the target source code file, and pre-stored code submission information, the method further comprises: generating, by means of a content generation model, operation prompt information for the abnormal code, wherein the operation prompt information is used to indicate a repair solution for the abnormal code; The operation prompt information is pushed to the user who submitted the abnormal code.
8. The method according to claim 7, wherein the operation prompt information is used to indicate a repair solution for the abnormal code, including: The operation prompt information is used to indicate a code modified based on the abnormal code; The operation prompt information is further used to provide a code submission entry, and the code submission entry is used to replace the abnormal code with the code indicated by the operation prompt information after being triggered.
9. An electronic device comprising: processor; A memory for storing processor-executable instructions; wherein the processor implements the steps of the exception handling method according to any one of claims 1 to 8 by running the executable instructions.
10. A computer-readable storage medium having computer instructions stored thereon, wherein when the computer instructions are executed by a processor, the steps of the exception handling method according to any one of claims 1 to 8 are implemented.
11. A computer program product, comprising a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the steps of the exception handling method according to any one of claims 1 to 8 are implemented.