Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to record network request exceptions with the Fundebug plug-in

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about how to use the Fundebug plug-in to record network request anomalies. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

On the server side, whether we use Node.js, Java, PHP, Python, and so on, the request and error messages are recorded in the form of a log. This is useful for after-work analysis at the back end.

On the other hand, sometimes there is something wrong with the front end because the back-end interface reports an error and returns abnormal data. In fact, the front end is the end that the user directly touches, so when something goes wrong, first of all, it is reflected in the front end, and the first thing is to find the front end.

In order to better locate whether the problem is front-end code or interface problems, it is recommended to use Fundebug's front-end JavaScript monitoring plug-in here. The plug-in has supported the monitoring of HTTP request errors since 0. 1.

Examples

For testing, I wrote a simple example. No complex framework is used, just a simple HTML plus a web-requested JS.

Test HTTP Request This is a test for HTTP request error! Clickfunction loadRequest () {var oReq = new XMLHttpRequest (); oReq.open ("GET", "http://127.0.0.1:8080/example/"); oReq.send ();}"

Run directly using the http-server command (recommended tip: use npm install-g http-server to install a simple server.) Enter the address http://127.0.0.1:8080 in the browser to access the page

Clicking the click button on the page will trigger this error. You can see the error message in the console of Fundebug, as shown below:

Click on the error to view the error details. A get for http requests access to http://127.0.0.1:8080/example/ and returns 404. Of course, there are many types of request errors in http, not only can you catch 404,401,403,500 and so on.

In addition, the process of triggering an error message can also be well seen through user behavior:

Cross-domain problem

If you are accessing a request that is not of the same origin, then the error will not get the status code, that is, the status will not be 404, but 0. This is more painful!

What are the benefits of monitoring HTTP request errors?

The HTTP request was found to be in trouble at the first time

Timely inform the back-end server that there is a problem and deal with it quickly

There is an additional information reference when analyzing other bug at the front end.

When the user feedback service is not available, you can quickly know the cause of the problem.

The above is how to use the Fundebug plug-in to record network request exceptions. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report