CN111142851A - Abnormal request processing method and device, electronic equipment and storage medium - Google Patents

Abnormal request processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111142851A
CN111142851A CN201911400575.1A CN201911400575A CN111142851A CN 111142851 A CN111142851 A CN 111142851A CN 201911400575 A CN201911400575 A CN 201911400575A CN 111142851 A CN111142851 A CN 111142851A
Authority
CN
China
Prior art keywords
request
returned
error
ajax
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN201911400575.1A
Other languages
Chinese (zh)
Inventor
魏龙
李文
杨航
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Mininglamp Software System Co ltd
Original Assignee
Beijing Mininglamp Software System Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Mininglamp Software System Co ltd filed Critical Beijing Mininglamp Software System Co ltd
Priority to CN201911400575.1A priority Critical patent/CN111142851A/en
Publication of CN111142851A publication Critical patent/CN111142851A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/32Monitoring with visual or acoustical indication of the functioning of the machine
    • G06F11/324Display of status information
    • G06F11/327Alarm or error message display
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides an abnormal request processing method, an abnormal request processing device, electronic equipment and a storage medium, wherein Ajax requests returned by a server are intercepted through Axios plug-ins; when the returned Ajax request is an abnormal request, uniformly processing the abnormal request to generate prompt information; and displaying the prompt information. The scheme provided by the invention intensively and uniformly processes all Ajax error information, and can add or delete the configuration of specific error codes according to the actual situation. And judging the data returned by the server, if the readability of the information returned by the server is higher, displaying, and if the readability of the data returned by the server is lower, replacing and displaying by using a general prompt configured at the front end. The technical scheme provided by the invention can be independently extracted into a general file, thereby reducing the development difficulty.

Description

Abnormal request processing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of front-end development technologies, and in particular, to an exception request processing method and apparatus, an electronic device, and a storage medium.
Background
The web application system can involve interaction of a front end and a back end, and the ajax request is a main technical means of the interaction of the front end and the back end. With the increasing system scale, the number of ajax requests is also increased continuously, the state returned by the requests has a plurality of conditions, which can be roughly divided into two conditions of request success and request failure, and for the condition of request exception, capturing is generally required first, and then effective user prompt is made. Two problems are encountered at this point in time that increase the development and maintenance effort if separate error trapping and user prompting is performed within each ajax request. For the content of the error prompt, the prompt may need to be performed by using information returned from the background, and the prompt may need to be performed by using information configured at the front end.
Disclosure of Invention
In view of the above, embodiments of the present invention provide an exception request handling method, an exception request handling apparatus, an electronic device, and a storage medium, so as to solve the above problems.
The embodiment of the invention provides an abnormal request processing method, which is applied to a front end and comprises the following steps: intercepting Ajax requests returned by the server through the Axios plug-in; when the returned Ajax request is an abnormal request, uniformly processing the abnormal request to generate prompt information; and displaying the prompt information.
Further, the exception request includes an error code, and when the returned Ajax request is an exception request, the exception request is uniformly processed to generate prompt information, including:
matching in a pre-configured error information base according to the error codes to determine error information, wherein the error information base comprises error information corresponding to a plurality of error codes;
and determining the error reporting information as the prompt information.
Further, when the returned Ajax request is an abnormal request, the abnormal request is processed in a unified manner to generate prompt information, and the method further includes:
and if the error reporting information matched with the error code does not exist, determining a pre-configured general prompt as the prompt information.
Further, the returned Ajax request includes a return code, and before the returned Ajax request is an abnormal request, the abnormal request is uniformly processed and prompt information is generated, the abnormal request processing method further includes:
determining whether the returned Ajax request is an abnormal request or not according to the return code;
when the returned code is error code, determining that the returned Ajax request is an abnormal request;
and when the returned code is not error code, determining that the returned Ajax request is a normal request.
Further, when the returned request would be a normal request;
determining whether the returned ajax request is an abnormal request;
the present invention also provides an exception request processing apparatus, configured to execute an exception request processing method, where the exception request processing apparatus includes:
the intercepting module is used for intercepting the Ajax request returned by the server through the Axios plug-in;
the processing module is used for uniformly processing the abnormal request to generate prompt information when the returned Ajax request is an abnormal request;
and the display module displays the prompt information.
Further, the exception request includes an error code, the processing module is further configured to perform matching in a pre-configured error information base according to the error code to determine error reporting information, the error information base includes error reporting information corresponding to a plurality of error codes, and the processing module is further configured to determine the error reporting information as the prompt information.
Further, the processing module is further configured to determine a pre-configured general prompt as the prompt information when there is no error information matching the error code.
Further, the returned Ajax request comprises a return code, and the processing module is further used for determining whether the returned Ajax request is an abnormal request according to the return code;
the processing module is further used for determining the returned Ajax request as an abnormal request when the returned code is an error code; and when the returned code is not error code, determining that the returned Ajax request is a normal request.
The invention also provides an electronic device comprising a processor for executing computer program instructions to implement the steps of the exception request handling method.
The present invention also provides a storage medium storing computer program instructions which, when executed by a processor, implement the steps of the above-described method of processing an exception request.
Compared with the prior art, the invention has the following beneficial effects:
the invention provides an abnormal request processing method, an abnormal request processing device, electronic equipment and a storage medium, wherein Ajax requests returned by a server are intercepted through Axios plug-ins; when the returned Ajax request is an abnormal request, uniformly processing the abnormal request to generate prompt information; and displaying the prompt information. The scheme provided by the invention intensively and uniformly processes all Ajax error information, and can add or delete the configuration of specific error codes according to the actual situation. And judging the data returned by the server, if the readability of the information returned by the server is higher, displaying, and if the readability of the data returned by the server is lower, replacing and displaying by using a general prompt configured at the front end. The technical scheme provided by the invention can be independently extracted into a general file, thereby reducing the development difficulty.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 shows a schematic diagram of an electronic device provided by the present invention.
Fig. 2 shows a schematic diagram of an application scenario of an electronic device.
Fig. 3 is a flowchart illustrating an exception request processing method according to the present invention.
Fig. 4 is a flow chart illustrating another exception request processing method provided by the present invention.
Fig. 5 is a flow chart illustrating another exception request processing method provided by the present invention.
Fig. 6 shows a schematic diagram of an exception request handling apparatus provided in the present invention.
Icon: 100-an electronic device; 10-a processor; 11-a memory; 12-a bus; 13-a communication interface; 200-a server; 300-exception request handling means; 310-an interception module; 320-a processing module; 330-display module.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below.
It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
It is noted that relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The web application system can involve interaction of a front end and a back end, and Ajax requests are main technical means of interaction of the front end and the back end. With the increasing system scale, the number of Ajax requests is also increased continuously, the state returned by the requests has a plurality of conditions, which can be roughly divided into two conditions of request success and request failure, and for the condition of request exception, capturing is generally required first, and then effective user prompt is made. Two problems are encountered at this point in time that increase the development and maintenance effort if separate error trapping and user prompting is performed within each Ajax request. For the content of the error prompt, the prompt may need to be performed by using information returned from the background, and the prompt may need to be performed by using information configured at the front end.
In the prior art, each Ajax request can be subjected to exception capture, and each Ajax request is subjected to separate processing. However, each Ajax request is subjected to exception handling independently, the returned state needs to be judged in each request, the development amount is increased, a large number of redundant codes are generated, and the later maintenance cost is increased. Furthermore, if the common success and error methods of Ajax are used, they are triggered based on the response status code. When XMLHttpRequest.status is 200, response is successful, success () is triggered, and error () is triggered by other status codes. At this time, the status codes in the error are generally represented, and manual judgment is still needed if subdivision is needed.
In the prior art, all Ajax request responses on a page can be intercepted by using an Ajax setup method provided by jquery. Therefore, the Ajax request responses can be processed uniformly, but the jquery library is large in size, and certain loss on the performance of the front end is caused. The Ajax in the jquery library is only a small part of functions, and for the items of the frames such as act and vue commonly used at the front end, the whole jquery cannot be introduced due to the function of the Ajax, and large-bright redundant codes are introduced.
Referring to fig. 1, fig. 1 shows a schematic view of an electronic device 100 provided in this embodiment. The electronic device 100 includes a processor 10, a memory 11, and a bus 12. The processor 10 and the memory 11 are connected by a bus 12, and the processor 10 is configured to execute executable modules, such as computer program instructions, stored in the memory 11.
The processor 10 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the data storage method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 10. The Processor 10 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
The Memory 11 may comprise a high-speed Random Access Memory (RAM) and may further comprise a non-volatile Memory (non-volatile Memory), such as at least one disk Memory.
The bus 12 may be an ISA (Industry Standard architecture) bus, a PCI (peripheral component interconnect) bus, an EISA (extended Industry Standard architecture) bus, or the like. Only one bi-directional arrow is shown in fig. 1, but this does not indicate only one bus 12 or one type of bus 12.
The memory 11 is used for storing programs, such as programs corresponding to the data storage device. The data storage means includes at least one software functional module which may be stored in the memory 11 in the form of software or firmware (firmware) or solidified in an Operating System (OS) of the electronic device. The processor 10, upon receiving the execution instruction, executes the program to implement the data storage method.
Possibly, the electronic device provided by the embodiment of the present application further includes a communication interface 13. The communication interface 13 is connected to the processor 10 via a bus. The electronic device receives the data sent by the server through the communication interface 13.
It should be understood that the structure shown in FIG. 1 is only a partial schematic view of electronic device 100, and that electronic device 100 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
Fig. 2 shows an application environment of the electronic device 100. The electronic device 100 is in communication connection with the server 200 through a network to transmit data to the server 200 or to receive data returned by the server 200. The network may be a wireless network or a wired network.
In the embodiment of the present invention, the electronic device 100 is preferably a mobile terminal device, and may include a smart phone, a tablet computer, an e-book reader, a laptop portable computer, a car-mounted computer, a wearable mobile terminal, and so on.
Based on the electronic device 100 in fig. 1, the present embodiment provides an exception request processing method, and referring to fig. 3, fig. 3 shows a flowchart of the exception request processing method provided in the present embodiment, where the exception request processing method provided in the present embodiment includes steps 110 to 130.
Step 110: and intercepting the Ajax request returned by the server through the Axios plug-in.
The interceptor using Axios can process all HTTP requests and responses uniformly, the Axios is a premium-based HTTP library and can be used in browsers and nodes.
All Ajax requests returned by the server are intercepted by introducing Axios, wherein the Ajax requests comprise normal requests and also comprise abnormal requests.
Step 120: and when the returned Ajax request is an abnormal request, uniformly processing the abnormal request to generate prompt information.
When the returned Ajax request is an abnormal request, uniformly processing the abnormal request, determining abnormal types, error information and the like, and if the data returned by the server is suitable for being displayed for a user and has high readability, generating prompt information according to the data returned by the server and displaying the prompt information; and if the data returned by the server is not suitable for being displayed for the user and the readability is poor, replacing and displaying the data by using a general prompt configured at the front end, and displaying the returned data by using prompt information with readable bits.
Step 130: and displaying the prompt information.
And after uniformly processing the abnormal requests returned by the server to generate prompt information, displaying the prompt information to enable the user to know the specific abnormal information of the abnormal requests.
The method for processing the abnormal request provided by the invention intercepts the Ajax request returned by the server through the Axios plug-in; when the returned Ajax request is an abnormal request, uniformly processing the abnormal request to generate prompt information; and displaying the prompt information. The scheme provided by the invention intensively and uniformly processes all Ajax error information, and can add or delete the configuration of specific error codes according to the actual situation. And judging the data returned by the server, if the readability of the information returned by the server is higher, displaying, and if the readability of the data returned by the server is lower, replacing and displaying by using a general prompt configured at the front end. The technical scheme provided by the invention can be independently extracted into a general file, thereby reducing the development difficulty.
In a possible implementation manner, the exception request returned by the server may be an exception caused by a front-end configuration error, or an exception caused by a failure of the back-end server, where the returned Ajax requests each include a return code, and the returned Ajax request may be determined to be an exception request or a normal request according to the return code, on the basis of fig. 3, referring to fig. 4, before step 120, the exception request processing method further includes the following steps:
step 111: and determining whether the returned Ajax request is an abnormal request or not according to the return code.
In one possible implementation, when the server is configured, the possible situations and the return codes of the Ajax requests returned by the server are preset. For example, if the return codes include 1XX to 8XX, the Ajax requests of the returns represented by the return codes 1XX to 2XX may be set as normal requests, the requests of the returns represented by 3XX to 8XX are set as abnormal requests, that is, 3XX to 8XX are error codes, and 1XX to 2XX are not error codes. That is, the return codes of the normal request and the abnormal request are set in advance, when the Ajax request returned by the server is intercepted, the returned Ajax request can be determined to be the normal request or the abnormal request according to the code of the returned Ajax request, and when the return code is the error code, the returned Ajax request is determined to be the abnormal request. And when the returned code is not error code, determining that the returned Ajax request is a normal request.
While error coding and non-error coding are set for the return code, specific error information represented by the error coding is also set. In one possible implementation, an error information base is configured in advance, and the error information base stores error codes and error reporting information corresponding to the error codes. It will be appreciated that the error information base may be configured manually or may be computer-implemented. When the abnormal request is intercepted, the error reporting information of the abnormal request can be determined according to the error coding of the abnormal request, and referring to fig. 5 on the basis of fig. 4, step 120 includes the following sub-steps:
step 120-1: and matching in a pre-configured error information base according to the error codes to determine error reporting information, wherein the error information base comprises the error reporting information corresponding to the plurality of error codes.
And matching the error code with a pre-configured error information base to determine error reporting information corresponding to the error code. It is understood that the error information base stores a plurality of error codes and corresponding error information, and the error codes of the intercepted abnormal requests are matched with the error information base to determine the error information.
Step 120-2: and determining the error information as prompt information.
When the error code of the intercepted abnormal request is matched with the error code in the error information base, the error reporting information corresponding to the matched error code can be used as prompt information.
For example, by configuring http response interpreter, when the error code returned by the backend server interface is 400, the error information is "request error". When the error code returned by the back-end server interface is 401, the error reporting information is "unauthorized, please log in". When the error code returned by the back-end server interface is 403, the error information is "access denied". When the error code returned by the back-end server interface is 404, the error information is "request address error". When the error code returned by the back-end server interface is 408, the error reporting information is "request overtime". When the error code returned by the back-end server interface is 500, the error reporting information is "server internal error". When the error code returned by the back-end server interface is 501, the error reporting information is "service is realized". When the error code returned by the backend server interface is 502, the error reporting information is "gateway error". When the error code returned by the backend server interface is 503, the error reporting information is "service unavailable". When the error code returned by the back-end server interface is 504, the error reporting information is "gateway timeout". When the error code returned by the back-end server interface is 505, the error reporting information is "HTTP version is not supported".
The above embodiment only illustrates the correspondence relationship between a part of error codes and error reporting information, and in another embodiment of this embodiment, other error codes and error reporting information may be configured, which is not limited in this embodiment.
It should be noted that, the error information base may not be configured with all error codes, and therefore, in the matching process, there may be a case where the corresponding error information cannot be matched. Step 120 further comprises:
step 120-3: and if no error information matched with the error code exists, determining the pre-configured general prompt as the prompt information.
When the error code of the intercepted abnormal request cannot be matched with the corresponding error code and error reporting information in the error database, for example, when the returned error code is empty or has english characters or irregular numerical codes, the readability of the returned data content is poor and the returned data content is unreadable to a user, a pre-configured general prompt is determined as the prompt information, and the pre-configured general prompt may be, for example, "please contact an administrator", "please retry", or the like.
It should be noted that steps 120-1 to 120-2 and 120-3 may be performed simultaneously.
In order to perform the method for processing an exception request and corresponding steps in each possible implementation manner in the above embodiments, an implementation manner of the exception request processing apparatus 300 is given below. Referring to fig. 6, fig. 6 is a functional module diagram of an exception request processing apparatus 300 according to an embodiment of the present disclosure. It should be noted that the basic principle and the generated technical effect of the exception request processing apparatus 300 provided in the present embodiment are the same as those of the exception request processing method provided in the foregoing embodiment, and for a brief description, the contents not mentioned in the present embodiment can refer to the corresponding contents in the foregoing embodiment.
Referring to fig. 6, the exception request processing apparatus 300 includes an intercepting module 310, a processing module 320, and a display module 330.
The intercepting module 310 is configured to intercept, through the Axios plug-in, the Ajax request returned by the server 200. The interceptor using Axios can process all HTTP requests and responses uniformly, the Axios is a premium-based HTTP library and can be used in browsers and nodes. All Ajax requests returned by the server 200 are intercepted by introducing Axios, wherein the Ajax requests comprise normal requests and also comprise abnormal requests.
Optionally, in a possible implementation manner, the intercepting module 310 may be configured to execute step 110 in each of the above-mentioned figures to achieve a corresponding technical effect.
The processing module 320 is configured to determine whether the returned Ajax request is an abnormal request according to the return code.
In one possible implementation, when the server 200 is configured, the possible situations and the return codes of the Ajax requests returned by the server 200 are preset. For example, if the return codes include 1XX to 8XX, the Ajax requests of the returns represented by the return codes 1XX to 2XX may be set as normal requests, the requests of the returns represented by 3XX to 8XX are set as abnormal requests, that is, 3XX to 8XX are error codes, and 1XX to 2XX are not error codes. That is, the return codes of the normal request and the abnormal request are set in advance, when the Ajax request returned by the server 200 is intercepted, the returned Ajax request can be determined to be the normal request or the abnormal request according to the code of the returned Ajax request, and when the return code is the error code, the returned Ajax request is determined to be the abnormal request. And when the returned code is not error code, determining that the returned Ajax request is a normal request.
Optionally, in a possible implementation manner, the processing module 320 may be configured to execute step 111 in each of the above-mentioned figures to achieve a corresponding technical effect.
The processing module 320 is further configured to, when the returned Ajax request is an abnormal request, perform unified processing on the abnormal request, and generate a prompt message.
When the returned Ajax request is an abnormal request, uniformly processing the abnormal request, determining an abnormal type, error information and the like, and if the data returned by the server 200 is suitable for being displayed for a user and has high readability, generating prompt information according to the data returned by the server 200 and displaying the prompt information; if the data returned by the server 200 is not suitable for being displayed for the user and the readability is poor, replacing and displaying the data by using a general prompt configured at the front end, and displaying the returned data by using prompt information with readable bits.
Optionally, in a possible implementation manner, the processing module 320 may be configured to execute step 120 in each of the above-mentioned figures to achieve a corresponding technical effect.
In a possible implementation manner, the processing module 320 is configured to perform matching on a pre-configured error information base according to an error code to determine error information, where the error information base includes error information corresponding to a plurality of error codes, and the processing module 320 is further configured to determine the error information as a prompt message.
Optionally, in a possible implementation manner, the processing module 320 may be specifically configured to execute steps 120-1 to 120-2 in the above-mentioned figures to achieve the corresponding technical effect.
It should be noted that, the error information base may not be configured with all error codes, and therefore, in the matching process, there may be a case where the corresponding error information cannot be matched. In a possible implementation, the processing module 320 is further configured to determine a pre-configured general-purpose hint as the hint information if there is no error information matching the error code.
When the error code of the intercepted abnormal request cannot be matched with the corresponding error code and error reporting information in the error database, for example, when the returned error code is empty or has english characters or irregular numerical codes, the readability of the returned data content is poor and the returned data content is unreadable to a user, a pre-configured general prompt is determined as the prompt information, and the pre-configured general prompt may be, for example, "please contact an administrator", "please retry", or the like.
Optionally, in a possible implementation manner, the processing module 320 may be specifically configured to execute step 120-3 in each of the above-mentioned figures to achieve a corresponding technical effect.
And the display module 330 is configured to display the prompt information.
Optionally, in a possible implementation manner, the display module 330 may be configured to execute the step 130 in each of the above figures to achieve a corresponding technical effect.
The present invention also provides a storage medium storing computer program instructions, such as the exception request processing apparatus 300 provided in the above embodiment, which when executed by the processor 10, implement the steps of the above exception request processing method.
In summary, the present invention provides a method, an apparatus, an electronic device, and a storage medium for processing an exception request, where the Ajax request returned by a server is intercepted by an Axios plug-in; when the returned Ajax request is an abnormal request, uniformly processing the abnormal request to generate prompt information; and displaying the prompt information. The scheme provided by the invention intensively and uniformly processes all Ajax error information, and can add or delete the configuration of specific error codes according to the actual situation. And judging the data returned by the server, if the readability of the information returned by the server is higher, displaying, and if the readability of the data returned by the server is lower, replacing and displaying by using a general prompt configured at the front end. The technical scheme provided by the invention can be independently extracted into a general file, thereby reducing the development difficulty.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Although the present invention is disclosed above, the present invention is not limited thereto. Various changes and modifications may be effected therein by one skilled in the art without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (10)

1. An exception request processing method, applied to a front end, includes:
intercepting Ajax requests returned by the server through the Axios plug-in;
when the returned Ajax request is an abnormal request, uniformly processing the abnormal request to generate prompt information;
and displaying the prompt information.
2. The method according to claim 1, wherein the exception request includes an error code, and the step of performing unified processing on the exception request to generate a hint information when the returned Ajax request is an exception request includes:
matching in a pre-configured error information base according to the error codes to determine error information, wherein the error information base comprises error information corresponding to a plurality of error codes;
and determining the error reporting information as the prompt information.
3. The method according to claim 2, wherein when the returned Ajax request is an abnormal request, the step of uniformly processing the abnormal request to generate a prompt message further comprises:
and if the error reporting information matched with the error code does not exist, determining a pre-configured general prompt as the prompt information.
4. The method according to claim 1, wherein the returned Ajax request includes a return code, and before the processing of the exception request is performed in a unified manner and a hint is generated when the returned Ajax request is an exception request, the method further includes:
determining whether the returned Ajax request is an abnormal request or not according to the return code;
when the returned code is error code, determining that the returned Ajax request is an abnormal request;
and when the returned code is not error code, determining that the returned Ajax request is a normal request.
5. An exception request processing apparatus, wherein the exception request processing apparatus is configured to execute the exception request processing method according to any one of claims 1 to 4, and the exception request processing apparatus comprises:
the intercepting module is used for intercepting the Ajax request returned by the server through the Axios plug-in;
the processing module is used for uniformly processing the abnormal request to generate prompt information when the returned Ajax request is an abnormal request;
and the display module is used for displaying the prompt information.
6. The apparatus according to claim 5, wherein the exception request includes an error code, the processing module is further configured to perform matching in a pre-configured error information base according to the error code to determine error reporting information, the error information base includes error reporting information corresponding to a plurality of error codes, and the processing module is further configured to determine the error reporting information as the prompt information.
7. The exception request handling apparatus according to claim 6, wherein the processing module is further configured to determine a pre-configured general hint as the hint information when there is no error information matching the error code.
8. The exception request handling apparatus according to claim 5, wherein the returned Ajax request includes a return code, and the processing module is further configured to determine whether the returned Ajax request is an exception request according to the return code;
the processing module is further used for determining the returned Ajax request as an abnormal request when the returned code is an error code; and when the returned code is not error code, determining that the returned Ajax request is a normal request.
9. An electronic device, characterized in that the electronic device comprises a processor for executing computer program instructions to implement the steps of the method according to any of claims 1-4.
10. A storage medium, characterized in that it stores computer program instructions which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 4.
CN201911400575.1A 2019-12-30 2019-12-30 Abnormal request processing method and device, electronic equipment and storage medium Withdrawn CN111142851A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911400575.1A CN111142851A (en) 2019-12-30 2019-12-30 Abnormal request processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911400575.1A CN111142851A (en) 2019-12-30 2019-12-30 Abnormal request processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111142851A true CN111142851A (en) 2020-05-12

Family

ID=70522177

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911400575.1A Withdrawn CN111142851A (en) 2019-12-30 2019-12-30 Abnormal request processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111142851A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112667948A (en) * 2020-12-30 2021-04-16 杭州天阙科技有限公司 Data communication method and system based on Fetch
CN112905160A (en) * 2021-02-08 2021-06-04 中国工商银行股份有限公司 Axios-based package registration global interception method and device
CN115442437A (en) * 2022-11-07 2022-12-06 北京智象信息技术有限公司 Token expiration automatic renewal authentication method, device, equipment and medium
CN116112558A (en) * 2022-11-21 2023-05-12 上海浦东发展银行股份有限公司 Interface interception method and system based on axios

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120209945A1 (en) * 2011-02-16 2012-08-16 Jayadev Chandrasekhar Optimizing Server Resources Using Multiple Retry For High Traffic Websites
CN106603520A (en) * 2016-12-08 2017-04-26 深圳Tcl数字技术有限公司 Abnormal information interception method and apparatus thereof
CN107038041A (en) * 2016-12-27 2017-08-11 阿里巴巴集团控股有限公司 The dynamic compatibility method of data processing method, error code, device and system
CN107995274A (en) * 2017-11-27 2018-05-04 中国银行股份有限公司 A kind of information cuing method and front-end server based on business scenario coding

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120209945A1 (en) * 2011-02-16 2012-08-16 Jayadev Chandrasekhar Optimizing Server Resources Using Multiple Retry For High Traffic Websites
CN106603520A (en) * 2016-12-08 2017-04-26 深圳Tcl数字技术有限公司 Abnormal information interception method and apparatus thereof
CN107038041A (en) * 2016-12-27 2017-08-11 阿里巴巴集团控股有限公司 The dynamic compatibility method of data processing method, error code, device and system
CN107995274A (en) * 2017-11-27 2018-05-04 中国银行股份有限公司 A kind of information cuing method and front-end server based on business scenario coding

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112667948A (en) * 2020-12-30 2021-04-16 杭州天阙科技有限公司 Data communication method and system based on Fetch
CN112905160A (en) * 2021-02-08 2021-06-04 中国工商银行股份有限公司 Axios-based package registration global interception method and device
CN115442437A (en) * 2022-11-07 2022-12-06 北京智象信息技术有限公司 Token expiration automatic renewal authentication method, device, equipment and medium
CN116112558A (en) * 2022-11-21 2023-05-12 上海浦东发展银行股份有限公司 Interface interception method and system based on axios

Similar Documents

Publication Publication Date Title
CN111142851A (en) Abnormal request processing method and device, electronic equipment and storage medium
CN109684008B (en) Card rendering method, device, terminal and computer readable storage medium
CN110225104B (en) Data acquisition method and device and terminal equipment
CN107784011B (en) Webpage access method, client, webpage server and programmable device
CN111131221B (en) Interface checking device, method and storage medium
CN108038018B (en) Extensible log data storage method and device
CN110069217B (en) Data storage method and device
CN111338628A (en) Component rendering method and device
US10599505B1 (en) Event handling system with escalation suppression
CN112751920B (en) Block chain-based network interaction behavior evidence obtaining method and device and terminal
CN112069033A (en) Page monitoring method and device, electronic equipment and storage medium
CN111368231B (en) Method and device for testing heterogeneous redundancy architecture website
CN114329149A (en) Detection method and device for automatically capturing page information, electronic equipment and readable storage medium
CN110943982B (en) Document data encryption method and device, electronic equipment and storage medium
CN110704219B (en) Hardware fault reporting method and device and computer storage medium
CN115729727A (en) Fault repairing method, device, equipment and medium
CN111737129A (en) Service control method, service control device, computer readable medium and electronic equipment
CN109656805B (en) Method and device for generating code link for business analysis and business server
CN112380115A (en) Regression testing method and device, electronic equipment and storage medium
CN107729180B (en) Abnormal information processing method and device, computer device and readable storage medium
CN111124841A (en) Abnormal page alarming method and device and computer system
CN110968875B (en) Method and device for detecting permission vulnerability of webpage
US11769005B2 (en) Information uniqueness assessment using string-based collection frequency
CN114301893B (en) Log management method, system and readable storage medium
CN111045723B (en) Method and device for notifying code change between associated systems

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication

Application publication date: 20200512

WW01 Invention patent application withdrawn after publication