Moment For Technology

The status of an AXIos request when an exception occurs

Posted on Sept. 23, 2022, 1:43 p.m. by Jessica Daniels
Category: The front end Tag: The front end

The state of the AXIos request when an exception occurs:

1. Initiate an interface request when the client has no network

2. The network speed of the client is slow, and the interface request exceeds the timeout period set by the client, resulting in timeout

3. The server interface responds slowly and exceeds the timeout period set on the client, resulting in timeout

4. The network is abnormal due to other factors.

In each of these cases, the HTTP status is 0

When a network exception occurs, AXIos returns an error object with a key named code, which has the value ECONNABORTED (meaning the remote host rejects the network connection).

The request attribute in the error object is the XMLHttpRequest object. The status in the error object correctly records the HTTP error status code.

Search
About
mo4tech.com (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.