Access exception processing method, computer device and storage medium
By monitoring method calls and reporting error codes within the SDK, and receiving corrective data for initialization and invocation, the problem of SDK access failures not being repaired in a timely manner was solved, thus achieving stable operation of the application.
Patent Information
- Application Number
- CN202110314176.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-24
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2041-03-24
AI Technical Summary
During software development, when integrating third-party SDKs, the development and testing phases cannot foresee integration failures during online runtime, leading to application malfunctions that cannot be repaired in a timely manner.
By designing a repair module within the SDK, the system monitors method calls and generates error codes, reports the error codes to the toolkit server, receives correction data, initializes the SDK when the application starts, and calls the corresponding methods based on the correction data, thus achieving timely repair of anomalies.
Proactively monitor SDK anomalies, promptly detect and fix them, reduce the impact of anomalies on application operation, and improve the stability of the access party's program.
Smart Images

Figure CN115130091B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to an exception handling method, computer device, and storage medium. Background Technology
[0002] In software development, when a common function is involved, this function is abstracted into an SDK (Software Development Kit), which is a toolkit provided by a third party to implement a specific function of the product software. For example, if software needs to implement a sharing function, it can do so by calling a third-party toolkit that implements sharing functionality.
[0003] Because the development and testing phases of the access provider typically use debug SDK packages, it's impossible to foresee potential problems with the online SDK during actual application runtime. If an access failure occurs in the online SDK and is not repaired promptly, it will affect the application's operation. Summary of the Invention
[0004] Therefore, it is necessary to provide a method, apparatus, computer device, and storage medium for handling access anomalies that can be processed in a timely manner to address the aforementioned technical problems.
[0005] A method for handling access exceptions, the method comprising:
[0006] Start the application and initialize the software development kit;
[0007] Receive correction data from the toolkit server for error codes; the error codes are the error codes corresponding to the methods reported by the access terminal to the toolkit server when an exception occurs while calling the method of the software development kit;
[0008] Based on the corrected data, the method corresponding to the error code is invoked.
[0009] A method for handling access exceptions, the method comprising:
[0010] Receives a first error code uploaded by the first access terminal when an exception occurs in the method of calling the software development kit; the first access terminal corresponds to a first application.
[0011] Obtain the first correction data corresponding to the first error code;
[0012] The first application identifier is obtained based on the first error code, and first correction data for the first error code is sent to all access terminals corresponding to the first application identifier. When the access terminal starts the first application, it initializes the software development kit and calls the method corresponding to the first error code based on the first correction data.
[0013] An access exception handling device, comprising:
[0014] The initialization module is used to start the application and initialize the software development kit;
[0015] The receiving module is used to receive correction data issued by the toolkit server in response to error codes; the error codes are the error codes corresponding to the methods reported by the access terminal to the toolkit server when an exception occurs while calling the method of the software development kit.
[0016] The calling module is used to invoke the method corresponding to the error code based on the corrected data.
[0017] An access exception handling device, comprising:
[0018] Error code receiving module, used to receive the first error code uploaded by the first access terminal when an exception occurs in the method of calling the software development kit; the first access terminal corresponds to the first application;
[0019] The correction acquisition module is used to acquire the first correction data corresponding to the first error code;
[0020] The sending module is configured to obtain a first application identifier based on the first error code, and send first correction data for the first error code to all access terminals corresponding to the first application identifier. When the access terminal starts the first application, it initializes the software development kit and calls the method corresponding to the first error code based on the first correction data.
[0021] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program performing the following steps:
[0022] Start the application and initialize the software development kit;
[0023] Receive correction data from the toolkit server for error codes; the error codes are the error codes corresponding to the methods reported by the access terminal to the toolkit server when an exception occurs while calling the method of the software development kit;
[0024] Based on the corrected data, the method corresponding to the error code is invoked.
[0025] A computer-readable storage medium having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0026] Receives a first error code uploaded by the first access terminal when an exception occurs in the method of calling the software development kit; the first access terminal corresponds to a first application.
[0027] Obtain the first correction data corresponding to the first error code;
[0028] The first application identifier is obtained based on the first error code, and first correction data for the first error code is sent to all access terminals corresponding to the first application identifier. When the access terminal starts the first application, it initializes the software development kit and calls the method corresponding to the first error code based on the first correction data.
[0029] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program performing the following steps:
[0030] Start the application and initialize the software development kit;
[0031] Receive correction data from the toolkit server for error codes; the error codes are the error codes corresponding to the methods reported by the access terminal to the toolkit server when an exception occurs while calling the method of the software development kit;
[0032] Based on the corrected data, the method corresponding to the error code is invoked.
[0033] A computer-readable storage medium having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0034] Receives a first error code uploaded by the first access terminal when an exception occurs in the method of calling the software development kit; the first access terminal corresponds to a first application.
[0035] Obtain the first correction data corresponding to the first error code;
[0036] The first application identifier is obtained based on the first error code, and first correction data for the first error code is sent to all access terminals corresponding to the first application identifier. When the access terminal starts the first application, it initializes the software development kit and calls the method corresponding to the first error code based on the first correction data.
[0037] The aforementioned access exception handling method, device, computer equipment, and storage medium, when an exception occurs during SDK invocation, proactively report the corresponding error code to the toolkit server. Upon starting the application and initializing the software development kit, they receive correction data from the toolkit server for the error code, and then invoke the method corresponding to the error code based on the correction data. This method proactively monitors online SDK access exceptions on the access terminal and communicates with the toolkit server to obtain correction data for the error code. This allows for timely detection and repair of access exceptions, minimizing the impact of access exceptions on application operation. Attached Figure Description
[0038] Figure 1 This is an application environment diagram of the access exception handling method in one embodiment;
[0039] Figure 2 This is a flowchart illustrating the access exception handling method in one embodiment;
[0040] Figure 3 This is a flowchart illustrating the access exception handling method in another embodiment;
[0041] Figure 4 This is a flowchart illustrating the access exception handling method in another embodiment;
[0042] Figure 5 This is a flowchart illustrating the access exception handling method in yet another embodiment;
[0043] Figure 6 This is a structural block diagram of the access exception handling device in one embodiment;
[0044] Figure 7 This is a structural block diagram of the access exception handling device in another embodiment;
[0045] Figure 8 This is an internal structural diagram of a computer device in one embodiment;
[0046] Figure 9 This is a diagram of the internal structure of a computer device in another embodiment. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0048] Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to achieve data computing, storage, processing, and sharing.
[0049] Cloud technology is a collective term for network technologies, information technologies, integration technologies, management platform technologies, and application technologies applied to the cloud computing business model. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will all require robust system support, which can only be achieved through cloud computing.
[0050] Public cloud is one implementation of cloud technology. Public cloud typically refers to a cloud provided by a third-party provider to users that is accessible via the Internet. It may be free or inexpensive, and its core attribute is shared resource services. Many instances of this type of cloud exist, providing services across today's open public networks.
[0051] Based on cloud computing, the access terminal can call the SDK by accessing the SDK server. The server can be a standalone physical server, a server cluster composed of multiple physical servers, or a distributed system. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and the server can be connected directly or indirectly through wired or wireless communication, which is not limited herein.
[0052] The access exception handling method provided in this application can be applied to, for example... Figure 1In the application environment shown, SDK server 102 communicates with access terminal 104. The SDK server provides a general function that is implemented by the access terminal 104's application during runtime. This includes: starting the application and initializing the software development kit (SDK); receiving correction data from the SDK server for error codes; the error code being the method error reported by the access terminal to the SDK server when an exception occurs while calling a method in the SDK; and, based on the correction data, invoking the method corresponding to the error code.
[0053] In one embodiment, such as Figure 2 and Figure 3 As shown, an access exception handling method is provided, which can be applied to... Figure 1 Taking the access terminal in the example, the explanation includes the following steps:
[0054] Step 202: Start the application and initialize the software development kit.
[0055] An SDK (Software Development Kit) is a toolkit provided by a third party to implement a specific function of a product software. For example, if software needs to implement a sharing function, it can call a third-party toolkit that implements sharing functionality. When an application on the accessing terminal calls the SDK, it acts as the SDK access party. The SDK toolkit is initialized when the application is launched. While the accessing terminal may not use the SDK's functionality in every startup cycle (a startup cycle refers to the process from opening the application to its destruction), the SDK toolkit is initialized in almost every startup cycle. Multiple applications can access and call the SDK; for example, multiple applications implementing sharing functionality can call the same sharing functionality SDK.
[0056] Step 204: Receive correction data from the toolkit server for the error code; the error code is the error code corresponding to the method reported by the access terminal to the toolkit server when an exception occurs while calling a method of the software development kit.
[0057] In this application, a repair module is designed within the software development kit (SDK) to monitor the invocation of all methods within the SDK. When each method function of the SDK is called by the application, the repair module monitors it and generates the corresponding error code when an exception occurs during a method call.
[0058] Specifically, the repair module needs to acquire all the functions of the SDK and monitor the calls to the corresponding methods. Specifically, the repair module acquires all header files in the SDK and then injects reporting functions into all methods within those header files. When an application encounters an exception while calling a method of the SDK, it reports the corresponding error code to the SDK server based on the reporting function. The error code identifies the faulty application, method category, and fault type. Upon receiving the error code, the SDK server determines the faulty application, method category, and fault type based on the error code, and then obtains the corresponding repair method. For example, for the highest level of exception, such as a system crash, the SDK server notifies the SDK developers, who then fix the problem and obtain the repair code. For a data input exception, the correct input parameters corresponding to the method stored on the SDK server are retrieved. Therefore, the repair data can be either repair code or correct input parameters. The repair code and correct input parameters constitute the corrected data corresponding to the error code. When the application on the access terminal starts and initially calls the SDK, it retrieves the corrected data from the SDK server. Understandably, the toolkit sends correction data to all access terminals of the application that reported the error code, including the access terminal that reported the error code. In other words, all access terminals of the application receive correction data when starting the application and initializing the software development kit, and use this correction data to invoke the corrected error code. The access terminal that reported the error receives the correction data, while other access terminals can proactively and promptly correct the anomaly.
[0059] Step 206: Based on the corrected data, invoke the method corresponding to the error code.
[0060] When the application on the access terminal calls this method, it uses the repair code or the correct input parameters based on the error code to complete the call to this method.
[0061] The aforementioned access exception handling method proactively reports the corresponding error code to the toolkit server when an SDK call exception occurs. Upon application startup and software development kit initialization, it receives correction data from the toolkit server for the error code and then calls the corresponding method based on the correction data. This method proactively monitors online SDK access exceptions on the access terminal and communicates with the toolkit server to obtain correction data for the error code. This allows for timely detection and repair of exceptions, minimizing their impact on application operation. In another embodiment, the access exception handling method further includes a step where the access terminal proactively reports an error code when a call exception occurs. Specifically, when an application calls a method in the software development kit and an exception occurs, a reporting function is injected into all methods of various names in the software development kit. When an exception is detected in a method call, the abnormal functional module and the method sequence within that module are determined based on the preset reporting function, and the error code is obtained.
[0062] The repair module retrieves all header files from the SDK and then injects reporting functions into all methods within those header files. When an application encounters an exception while calling a method from the SDK, it reports the corresponding error code to the SDK server based on these reporting functions.
[0063] Specifically, the repair module needs to obtain all header files (.h files) in the SDK, and then replace all methods in the header files to inject the reporting function.
[0064] Specifically, a RepairCenter class is created. When the application starts, the loading method is called, which iterates through all object methods and class methods in all .h files in the SDK file directory and stores the class names and corresponding methods in memory as NSUserdefaults (stored objects).
[0065] The `funcUpload` function is declared and implemented. This function categorizes the defect error codes into functional modules and method categories for each method in the SDK. A registration method is provided in the repair class and called during SDK initialization. This method iterates through memory to retrieve all methods of the class name using method swizzling. The `class_getInstanceMethod` function is called to obtain instance methods. The instance methods and their implementations are copied, and the copied method names are renamed with underscores. The reporting function is then injected into the implementation. For example, the `funName` method is copied to `_funName`, and the reporting function is injected at the beginning of the `_funName` method implementation. Finally, the runtime's `method_exchangeImplementations` function is called to swap the implementations of the original instance and the copied method.
[0066] Functional modules and method sequences are used to locate anomalies. An SDK toolkit contains multiple functional modules, which combine to implement a specific function. Each functional module contains multiple methods, which combine to implement the module's functionality. For example, an SDK toolkit implementing a "scan" function includes modules for recognizing QR codes, recognizing bank cards, and recognizing ID cards. Taking the bank card recognition function as an example, the steps are as follows: open camera - select photo / scan image - acquire image - algorithm recognition - completion callback. Each step executes a corresponding method, and each step constitutes the method sequence of that functional module.
[0067] Specifically, when an exception is detected in a called method, the abnormal functional module and method sequence are determined based on a preset reporting function, and an error code is obtained, including: obtaining the application identifier; when an exception is detected in a called method, the abnormal functional module is determined based on a preset reporting function, the functional module identifier is obtained, and the error sequence code is obtained from the method sequence of the functional module; the exception level is determined; and an error code is generated based on the application identifier, functional module identifier, error sequence code, and exception level.
[0068] Specifically, the error code consists of four segments, each with a different meaning. The first segment is the application identifier, used to identify the application experiencing the access error. The second segment is the functional module identifier, used to identify the functional module within the functional toolkit. The third segment is the error sequence code, used to identify one of the methods within the functional module. The fourth segment is the exception level, used to indicate the severity of the exception.
[0069] A software development kit (SDK) can be integrated with multiple different applications to achieve the same functionality. For example, multiple different applications can call the SSD to implement sharing functionality. Therefore, error codes need to identify the malfunctioning application to facilitate troubleshooting for that application's call failure. The first part, the application identifier, is 4 to 12 characters long and indicates the source of the error. The integrating party needs to fill in the corresponding application identifier when registering the SDK. The application identifier must be unique for each application and is used to locate the error to the user's device system, facilitating troubleshooting based on device model and system error.
[0070] The second segment is the functional module identifier, which is 2 to 12 characters long. It represents the module number within the application system. The module abbreviation must be unique within the application. This helps to quickly locate the functional module and facilitates troubleshooting within the application.
[0071] The third segment is an error sequence code, 3 bits long, representing the sequence number of the error code. It is sequentially incremented during planning, and the error sequence number must be unique within the module, with a coding range of "001~999".
[0072] The reporting function divides the error code into the second and third segments for each method in the SDK, meaning that the methods in each functional module of the SDK can be located from the first three digits of the error code.
[0073] The fourth section, the error level, is one digit long and indicates the level of the error code, signifying the severity of the error. Severity is ranked from lowest to highest, indicated by the letters W, B, P, and S (Warning, Business error, Platform error, and Seurity error).
[0074] The determination of the exception level includes: if the exception type is a method interface call exception, then the exception level is determined as the first exception level based on the method call interface of the exception; if the exception type is a system crash, then the exception level is determined as the second exception level, where the second exception level is the highest exception level.
[0075] Because the SDK calls the registration method during initialization, it's equivalent to starting the repair module. After startup, it can monitor the invocation of all methods within the SDK and classify defect error codes into the fourth segment for methods with abnormal input. Each method in the SDK is called by the access party. At the time of the call, the developer knows the importance level of the current interface in the application, and the access party marks it as the first exception level. The first exception level includes warnings, business exceptions, platform exceptions, and security exceptions. That is, if the exception type is a method call exception, the first exception level is determined based on the interface of the exception method. The first exception level is usually abnormal input, including input parameter type exceptions and empty input parameters.
[0076] If the exception type is system crash, then the exception level is determined to be the second exception level. That is, the application crashes during the execution of the current call, the current function stack is recorded, the fourth segment of the error code is declared as the highest exception level, and the error is reported to the SDK server. It can be seen that, except for internal SDK crashes which are marked as the highest exception level, all other exception levels are passed in by the access party.
[0077] Below is an example of how to determine an error code:
[0078] The first part: When the access party accesses the SDK, it will obtain a 4- to 12-character string during the SDK registration. The first part can identify which App application it is (App identifier). When the SDK initializes, it requests the backend to upload the App identifier of the current application to the SDK server. For example, the obtained string is "abcd".
[0079] The second part: Determine the functional modules within the SDK. For example, in the scan SDK, there are functions to recognize QR codes, bank cards, and ID cards. The corresponding module codes are "aa", "bb", "cc", and "dd" respectively. After entering the QR code recognition function, the second part generated is "aa".
[0080] The third paragraph describes the steps required for the bank card recognition function: opening the camera, selecting a photo / scanning an image, acquiring the image, algorithm recognition, and a completion callback. Each step corresponds to the numbers "001", "002", "003", "004", and "005". If a defect occurs during image acquisition, this step generates the third paragraph, which is "003".
[0081] The fourth paragraph states that each method in the SDK is called by the access party. When calling a method, the developer knows the importance level of the current interface within the application, which is marked by the access party. Except for internal SDK crashes, which are marked as "S", all other levels are marked by the access party. In case of a crash, "S" is used.
[0082] The segments of the error code can be separated by spaces. Thus, the final generated defect error code is "abcd aa 003S".
[0083] In another embodiment, after the access terminal reports an error code to the toolkit server, the toolkit server determines various identifiers based on the error code. Specifically, based on the separators in each segment of the error code, such as spaces, the application identifier, functional module identifier, error sequence code, and exception level are obtained. Based on the exception level, the correction data corresponding to each error code is determined. Specifically, the correction data corresponding to the first exception level is the correct input parameters; the correction data corresponding to the second exception level is the repair code. For error codes with an exception level of the second exception level, the toolkit server notifies the SDK developers to perform a repair, obtaining the repair code.
[0084] Based on the corrected data, the method corresponding to the error code is invoked, including: invoking the method corresponding to the error code based on the correct input parameters, or locating the function code of the method based on the error code in the corrected data; replacing the function code of the method based on the repair code; and invoking the method corresponding to the error code based on the repair code.
[0085] Specifically, the toolkit server sends the error code and correction parameters to the access terminal. The access terminal uses the corrected data when calling the method corresponding to the error code. Specifically, the error is located based on the application identifier, functional module identifier, and error sequence code of the error code. Then, depending on the exception level, modified repair code or modified parameters are injected for the call. Specifically, for error codes at the first exception level, the corresponding method is called based on the correct input parameters. For error codes at the second exception level, the function code of the method is located based on the error code, and the corrected code replaces the original function code. The method is then called based on the repair code.
[0086] The above-mentioned access exception handling methods reduce the scope of online incidents in the SDK and improve the stability of the access party's program.
[0087] like Figure 4 As shown, an access exception handling method is provided, which is applied to... Figure 1 Taking the toolkit server in the example, the following steps are included:
[0088] S402, receive the first error code uploaded by the first access terminal when an exception occurs in the method of calling the software development kit, the first access terminal corresponding to the first application.
[0089] An SDK (Software Development Kit) is a toolkit provided by a third party to implement a specific function of a product's software. For example, if software needs to implement a sharing function, it can do so by calling a third-party toolkit that implements sharing functionality. When the application on the access terminal calls the SDK, it acts as an SDK access party. When the application is launched, it calls the software development kit as an SDK access party.
[0090] In this application, a repair module is designed within the software development kit (SDK) to monitor the invocation of all methods within the SDK. When each method function of the SDK is called by the application, the repair module monitors it and generates the corresponding error code when an exception occurs during a method call.
[0091] Specifically, the repair module needs to acquire all the functions of the SDK and monitor the calls to the corresponding methods. Specifically, the repair module obtains all header files in the SDK and then injects reporting functions into all methods within those header files. When an application encounters an exception while calling a method of the SDK, it reports the corresponding error code to the SDK server based on the reporting function. The error code identifies the faulty application, method category, and fault type.
[0092] There can be multiple applications that access and call the software development kit (SDK). For example, multiple applications implementing sharing functionality can call the same sharing function SSD. The first access terminal refers to the first application terminal, corresponding to the first application. When the first access terminal encounters an exception while calling the SDK package, it reports the first error code to the SDK server.
[0093] S404, obtain the first correction data corresponding to the first error code.
[0094] When the toolkit server receives an error code, it determines the faulty application, method category, and fault type based on the error code, and then obtains the corresponding repair method. For example, for the highest level of exception, such as a system crash, the toolkit server notifies the SDK developers, who then fix the problem and obtain the repair code. For a data input exception, it retrieves the correct input parameters corresponding to the method stored on the toolkit server. Therefore, the repair data can be either repair code or correct input parameters. The repair code and the correct input parameters constitute the first correction data corresponding to the first error code.
[0095] Specifically, for the first error code corresponding to the first exception level, the corresponding correct input parameter is used as the first correction data; for the first error code corresponding to the second exception level, the fix code provided by the developer is used as the first correction data.
[0096] After the access terminal reports an error code to the toolkit server, the toolkit server determines the identifiers based on the error code. Specifically, based on the separators in the error code, such as spaces, it obtains the application identifier, functional module identifier, error sequence code, and exception level. Based on the exception level, it determines the corresponding correction data for each error code. Specifically, for the first exception level, the first correction data is the correct input parameters; for the second exception level, the first correction data is the repair code. For the first error code at the second exception level, the toolkit server notifies the SDK developers to perform a repair, obtaining the repair code.
[0097] Step 406: Obtain the first application identifier based on the first error code.
[0098] Specifically, the error code consists of four segments, each with a different meaning. The first segment is the application identifier, used to identify the application experiencing the access error. The second segment is the functional module identifier, used to identify the functional module within the functional toolkit. The third segment is the error sequence code, used to identify one of the methods within the functional module. The fourth segment is the exception level, used to indicate the severity of the exception.
[0099] A software development kit (SDK) can be integrated with multiple different applications to achieve the same functionality. For example, multiple different applications can call the SSD to implement sharing functionality. Therefore, error codes need to identify the malfunctioning application to facilitate troubleshooting for that application's call failure. The first part, the application identifier, is 4 to 12 characters long and indicates the source of the error. The integrating party needs to fill in the corresponding application identifier when registering the SDK. The application identifier must be unique for each application and is used to locate the error to the user's device system, facilitating troubleshooting based on device model and system error.
[0100] The second segment is the functional module identifier, which is 2 to 12 characters long. It represents the module number within the application system. The module abbreviation must be unique within the application. This helps to quickly locate the functional module and facilitates troubleshooting within the application.
[0101] The third segment is an error sequence code, 3 bits long, representing the sequence number of the error code. It is sequentially incremented during planning, and the error sequence number must be unique within the module, with a coding range of "001~999".
[0102] The reporting function divides the error code into the second and third segments for each method in the SDK, meaning that the methods in each functional module of the SDK can be located from the first three digits of the error code.
[0103] The fourth segment, the error level, is one digit long and indicates the severity of the error code. Severity is ranked from lowest to highest, indicated by the letters W, B, P, and S (Warning, Business error, Platform error, and Security error). The first application identifier can be obtained from the first segment of the error code.
[0104] S408, send correction data for the first error code to all access terminals corresponding to the first application identifier. When the access terminal starts the first application, it initializes the software development kit and calls the method corresponding to the error code according to the correction data.
[0105] The toolkit server sends correction data for the first error code to all access terminals corresponding to the first application, based on the first application identifier. For example, if a user terminal of application A encounters a call exception while running the application, it reports an error code to the toolkit server. The toolkit server then sends correction data for the error code to all user terminals of application A. When the access terminal starts the program, it initializes the software development kit, receives the correction data for the error code from the toolkit server, and calls the method corresponding to the error code based on the correction data.
[0106] The aforementioned access exception handling method proactively reports the corresponding error code to the toolkit server when an SDK exception occurs. Upon application startup and software development kit initialization, it receives correction data from the toolkit server for the error code and then invokes the corresponding method based on the correction data. This method proactively monitors online SDK access exceptions on the accessing terminal and communicates with the toolkit server to obtain correction data for the error code. This allows for timely detection and repair of exceptions, minimizing their impact on application operation.
[0107] In another embodiment, an access exception handling method, such as Figure 5 As shown, it includes:
[0108] S502, receive the first error code uploaded by the first access terminal when an exception occurs in the method of calling the software development kit; the first access terminal corresponds to the first application.
[0109] S504, send a reporting instruction to the second access terminal; the second access terminal corresponds to the second application.
[0110] After receiving the first error code, the toolkit server sends a reporting instruction to the second access terminal to perform the same reporting operation. The second application, distinct from the first application, refers to all applications in the access software development kit except the first application. The second access terminal is the terminal of the second application. There can be multiple second applications. For example, if two applications are using the SDK toolkit, and the user terminal of the first application A reports an error code, the toolkit server sends a reporting instruction to the second access terminal of the second application B. If there are more than two applications using the SDK toolkit, and the user terminal of the first application A reports an error code, the toolkit server sends reporting instructions to the second access terminals corresponding to other applications (B, C, D, etc.). In this case, the second application refers to all applications calling the SDK toolkit except the first application.
[0111] S506, determine whether a second error code reported by the second access terminal has been received. If yes, proceed to step S508; otherwise, proceed to step S507.
[0112] When the second access terminal receives the reporting instruction, it performs the same reporting operation. If no second error code is received from the second access terminal, it indicates that no access anomalies have occurred in other access terminals. In this case, step S507 is executed, sending first correction data for the first error code to all access terminals corresponding to the first application identifier. When the access terminal starts the first application, it initializes the software development kit and, based on the first correction data, invokes the method corresponding to the first error code.
[0113] If a second error code is received from the second access terminal, then execute...
[0114] Step S508: Determine whether the first error code and the second error code have the same error. If they are the same, proceed to step S510. If they are different, proceed to steps S512 to S514.
[0115] Step S510: Obtain the second application identifier based on the second error code, and send correction data for the first error code to all access terminals corresponding to the first application identifier and all access terminals corresponding to the second application identifier.
[0116] Step S512: Obtain the second correction data corresponding to the second error code.
[0117] Step S514: Obtain the second application identifier based on the second error code, send correction data for the first error code to all access terminals corresponding to the first application identifier, and send second correction data for the second error code to all access terminals corresponding to the second application identifier; when the access terminal starts the application, it initializes the software development kit and calls the method corresponding to the error code based on the correction data.
[0118] Specifically, if a second error code is received from the second access terminal, it indicates that the applications of other access terminals have also experienced access anomalies. Further investigation is needed to determine if these are the same type of anomaly. Specifically, based on the last three segments of the error code, it is determined whether the first and second access terminals are experiencing the same type of anomaly. If so, the second application identifier is obtained based on the second error code, specifically the first segment of the second error code. The first correction data corresponding to the first error code is then sent to all access terminals corresponding to the first application identifier, and all access terminals corresponding to the second application identifier also send first correction data for the first error code.
[0119] If the first error code and the second error code are different errors, the same method used to obtain the first correction data for the first error code is employed to obtain the second correction data corresponding to the second error code. Based on the second error code, the second application identifier is obtained, and correction data for the first error code is sent to all access terminals corresponding to the first application identifier, and second correction data for the second error code is sent to all access terminals corresponding to the second application identifier. In other words, repairs are performed separately for different error codes of the application.
[0120] In this embodiment, the SDK server processes the error codes of access anomalies to obtain corrected data. Then, when other access terminals report anomalies, the corrected data can be sent to them. This means that anomalies in one access terminal can be used to promptly detect access anomalies in other access terminals, allowing for timely repair. When calling this method based on the error code, the access terminal uses the corrected code or the correct input parameters to invoke the method.
[0121] It should be understood that, although Figure 2-5 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2-5 At least some of the steps in the process may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but may be executed at different times. The execution order of these steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the steps or stages in other steps.
[0122] In one embodiment, such as Figure 6 As shown, an access exception handling device is provided. This device can be a software module, a hardware module, or a combination of both, integrated into a computer device. Specifically, the device includes:
[0123] Initialization module 602 is used to start the application and initialize the software development kit;
[0124] The receiving module 604 is used to receive correction data issued by the toolkit server in response to error codes; the error codes are the error codes corresponding to the methods reported by the access terminal to the toolkit server when an exception occurs while calling the method of the software development kit.
[0125] The calling module 606 is used to invoke the method corresponding to the error code based on the corrected data.
[0126] In another embodiment, it also includes:
[0127] The reporting function injection module is used to inject reporting functions into all methods of various names in the software development kit when an exception occurs when the application calls a method of the software development kit.
[0128] The error code reporting module is used to determine the abnormal functional module and the method sequence in the functional module based on a preset reporting function when an exception is detected in the called method, and to obtain the error code.
[0129] The error code reporting module is used to obtain the application identifier; when an exception is detected in a method call, it determines the abnormal functional module based on a preset reporting function, obtains the functional module identifier, and determines the error sequence code in the method sequence of the functional module; determines the exception level; and generates an error code based on the application identifier, the functional module identifier, the error sequence code, and the exception level.
[0130] If the exception type is a method interface call exception, the first exception level is determined based on the method call interface of the exception; if the exception type is a system crash, the exception level is determined as the second exception level, where the second exception level is the highest exception level.
[0131] The correction data corresponding to the first exception level is the correct interface input parameters; the correction data corresponding to the second exception level is the repair code. The calling module is used to invoke the method corresponding to the error code based on the correct interface input parameters, or to locate the function code of the method based on the error code in the correction data; to replace the function code of the method based on the repair code; and to invoke the method corresponding to the error code based on the repair code.
[0132] In another embodiment, such as Figure 7 As shown, an access exception handling device includes:
[0133] Error code receiving module 702 is used to receive a first error code uploaded by the first access terminal when an error occurs in the method of calling the software development kit; the first access terminal corresponds to the first application.
[0134] The correction acquisition module 704 is used to acquire the first correction data corresponding to the first error code;
[0135] The sending module 706 is used to obtain a first application identifier based on the first error code, and send first correction data for the first error code to all access terminals corresponding to the first application identifier. When the access terminal starts the first application, it initializes the software development kit and calls the method corresponding to the first error code based on the first correction data.
[0136] In another embodiment, the sending module is further configured to send a reporting instruction to a second access terminal; the second access terminal corresponds to a second application; if no error code is received from the second access terminal, the module sends first correction data for the first error code to all access terminals corresponding to the first application identifier; if a second error code is received from the second access terminal, and if the second error code has the same error as the first error code, the module obtains the second application identifier based on the second error code, and sends the first correction data for the first error code to all access terminals corresponding to the first application identifier and all access terminals corresponding to the second application identifier.
[0137] Specifically, the correction acquisition module is used to take the correct interface input parameters as correction data for the first error code corresponding to the first exception level; and to take the repair code reported by the developers as correction data for the second error code corresponding to the second exception level.
[0138] Specific limitations regarding the access exception handling device can be found in the limitations of the access exception handling method described above, and will not be repeated here. Each module in the aforementioned access exception handling device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0139] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 8 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores SDK data packages. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements an access exception handling method.
[0140] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements an access exception handling method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.
[0141] Those skilled in the art will understand that Figure 8-9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0142] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0143] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0144] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the steps in the above method embodiments.
[0145] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0146] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0147] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for handling access exceptions, characterized in that, The method includes: Start the application and initialize the software development kit; The system receives correction data from the toolkit server in response to error codes. The error codes are the method-related error codes reported by the access terminal to the toolkit server when an exception occurs while calling a method of the software development kit. The first segment of the error code is the application identifier used to identify the application experiencing the access exception; the second segment is the functional module identifier used to identify a functional module of the toolkit; the third segment is the error sequence code used to identify one of the methods within the functional module; and the fourth segment is the exception level used to identify the severity of the exception. The correction data is determined by the toolkit server based on the error codes sent by the access terminal, after determining the faulty application, the method category of the exception-causing method, and the exception level. Specifically, if the exception level is the first exception level, the correction data consists of the correct interface input parameters for the exception-causing method; if the exception level is the second exception level, the correction data consists of the repair code for the exception-causing method. When the exception level is the first exception level, the method is invoked by passing in the correct interface parameters of the method that caused the exception. When the exception level is the second exception level, the function code of the method that is experiencing the exception is located according to the error code, the function code of the method that is experiencing the exception is replaced according to the repair code of the method that is experiencing the exception, and the method is called according to the repair code.
2. The method according to claim 1, characterized in that, The method further includes: when an application encounters an exception while calling a method of the software development kit, injecting a reporting function into all methods of various names in the software development kit; When an exception is detected in a method call, the system determines the functional module that caused the exception and the method sequence within that functional module based on a preset reporting function, and then obtains the error code.
3. The method according to claim 2, characterized in that, When an anomaly is detected in a method call, the process of determining the abnormal functional module and the method sequence within that functional module based on a preset reporting function includes: Get the application identifier; When an exception is detected in a method call, the abnormal functional module is determined based on a preset reporting function, the functional module identifier is obtained, and the error sequence code is obtained from the method sequence in the functional module. Determine the anomaly level; An error code is generated based on the application identifier, the functional module identifier, the error sequence code, and the exception level.
4. The method according to claim 3, characterized in that, The determination of the anomaly level includes: If the exception type is a method interface call exception, then the exception level is determined according to the method calling interface of the exception. If the anomaly type is system crash, then the anomaly level is determined to be the second anomaly level, where the second anomaly level is the highest anomaly level.
5. A method for handling access exceptions, characterized in that, The method includes: The system receives a first error code uploaded by a first access terminal when an error occurs while calling a method of a software development kit; the first access terminal corresponds to a first application; the first segment of the first error code is an application identifier used to identify the application that caused the access error; the second segment of the first error code is a functional module identifier used to identify a functional module of the functional kit; the third segment of the first error code is an error sequence code used to identify one of the methods of the functional module; and the fourth segment of the first error code is an error level used to identify the degree of the error. Obtain the first correction data corresponding to the first error code; the first correction data is determined by the toolkit server after determining the faulty application, the method category of the abnormal method and the abnormality level based on the error code sent by the access terminal. In the case that the abnormality level is the first abnormality level, the first correction data is the correct interface input parameters of the abnormal method. In the case that the abnormality level is the second abnormality level, the first correction data is the repair code of the abnormal method. The first application identifier is obtained based on the first error code, and the first correction data for the first error code is sent to all access terminals corresponding to the first application identifier. When the access terminal starts the first application, it initializes the software development kit. When the exception level is the first exception level, it calls the method according to the correct interface input parameters of the method that has the exception. When the exception level is the second exception level, the function code of the method that is experiencing the exception is located according to the error code, the function code of the method that is experiencing the exception is replaced according to the repair code of the method that is experiencing the exception, and the method is called according to the repair code.
6. The method according to claim 5, characterized in that, After receiving the first error code uploaded by the first access terminal when an error occurs in the method of calling the software development kit, the method further includes: Send a reporting instruction to the second access terminal; the second access terminal corresponds to the second application. If no error code is received from the second access terminal, then the step of sending the first correction data for the first error code to all access terminals corresponding to the first application identifier is performed. If a second error code is received from the second access terminal, and if the second error code has the same error as the first error code, then the second application identifier is obtained based on the second error code, and first correction data for the first error code is sent to all access terminals corresponding to the first application identifier and all access terminals corresponding to the second application identifier.
7. The method according to claim 5, characterized in that, Obtaining the first correction data corresponding to the first error code includes: For the first error code corresponding to the first exception level, the corresponding correct interface input parameter is used as the first correction data; For the first error code corresponding to the second exception level, the fix code provided by the developer will be used as the first correction data.
8. An access anomaly handling device, characterized in that, The device includes: The initialization module is used to start the application and initialize the software development kit; The receiving module is used to receive correction data issued by the toolkit server in response to error codes. The error code is the method-related error code reported by the access terminal to the toolkit server when an exception occurs while calling a method of the software development kit. The first segment of the error code is the application identifier used to identify the application experiencing the access exception; the second segment is the functional module identifier used to identify a functional module of the toolkit; the third segment is the error sequence code used to identify one of the methods within the functional module; and the fourth segment is the exception level used to identify the degree of exception. The correction data is determined by the toolkit server based on the error code sent by the access terminal, after determining the faulty application, the method category of the exception-causing method, and the exception level. Specifically, if the exception level is the first exception level, the correction data consists of the correct interface input parameters for the exception-causing method; if the exception level is the second exception level, the correction data consists of the repair code for the exception-causing method. The calling module is used to invoke the method when the exception level is the first exception level, based on the correct interface parameters passed to the method that caused the exception; when the exception level is the second exception level, based on the error code, the function code of the method that caused the exception is located, based on the repair code of the method that caused the exception, the function code of the method is replaced, and based on the repair code, the method is invoked.
9. The apparatus according to claim 8, characterized in that, The device further includes a reporting function injection module and an error code reporting module. The reporting function injection module is used to inject reporting functions into all methods of various names in the software development kit when an exception occurs in the application's call to a method of the software development kit. The error code reporting module is used to determine the abnormal functional module and the method sequence in the functional module based on a preset reporting function when an exception is detected in the method call, and obtain the error code.
10. The apparatus according to claim 9, characterized in that, The error code reporting module is used to obtain the application identifier; when an exception is detected in a method call, it determines the abnormal functional module based on a preset reporting function, obtains the functional module identifier, and determines the error sequence code in the method sequence of the functional module; determines the exception level; and generates an error code based on the application identifier, the functional module identifier, the error sequence code, and the exception level.
11. The apparatus according to claim 10, characterized in that, If the exception type is a method interface call exception, it is determined to be the first exception level based on the method call interface of the exception; if the exception type is a system crash, it is determined to be the second exception level, where the second exception level is the highest exception level.
12. An access anomaly handling device, characterized in that, The device includes: An error code receiving module is used to receive a first error code uploaded by a first access terminal when an exception occurs in calling a method of a software development kit; the first access terminal corresponds to a first application; the first segment of the first error code is an application identifier used to identify the application that caused the access exception, the second segment of the first error code is a functional module identifier used to identify a functional module of the functional kit, the third segment of the first error code is an error sequence code used to identify one of the methods of the functional module, and the fourth segment of the first error code is an exception level used to identify the degree of exception; The correction acquisition module is used to acquire the first correction data corresponding to the first error code. The first correction data is determined by the toolkit server after determining the faulty application, the method category of the abnormal method, and the abnormality level based on the error code sent by the access terminal. In the case that the abnormality level is the first abnormality level, the first correction data is the correct interface input parameters of the abnormal method. In the case that the abnormality level is the second abnormality level, the first correction data is the repair code of the abnormal method. The sending module is configured to obtain a first application identifier based on the first error code, and send first correction data for the first error code to all access terminals corresponding to the first application identifier. When the access terminal starts the first application, it initializes the software development kit. If the exception level is the first exception level, it calls the method according to the correct interface input parameters of the method that has an exception. If the exception level is the second exception level, it locates the function code of the method that has an exception based on the error code, replaces the function code of the method with the repair code of the method that has an exception, and calls the method according to the repair code.
13. The apparatus according to claim 12, characterized in that, The sending module is further configured to send a reporting instruction to a second access terminal; the second access terminal corresponds to a second application; if no error code is received from the second access terminal, the step of sending first correction data for the first error code to all access terminals corresponding to the first application identifier is executed; if a second error code is received from the second access terminal, and if the second error code has the same error as the first error code, the second application identifier is obtained according to the second error code, and the first correction data for the first error code is sent to all access terminals corresponding to the first application identifier and all access terminals corresponding to the second application identifier.
14. The apparatus according to claim 12, characterized in that, The correction acquisition module is used to take the corresponding correct interface input parameters as the first correction data for the first error code corresponding to the first exception level. For the first error code corresponding to the second exception level, the fix code provided by the developer will be used as the first correction data.
15. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
16. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
17. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
SDK (Software Development Kit) inspection method and device, terminal equipment and storage medium
CN107943688A
SDK exception checking method and device and computer readable storage medium
CN111752735A