Unlock instant, AI-driven research and patent intelligence for your innovation.

Method for achieving Script error monitoring and reporting

A technology for error and abnormal information, applied in hardware monitoring, instruments, electrical and digital data processing, etc., can solve the problem of lack of perfect monitoring mechanism, and achieve the effect of reducing losses

Inactive Publication Date: 2019-09-17
SICHUAN CHANGHONG ELECTRIC CO LTD
View PDF6 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] The purpose of the present invention is to provide a method for realizing script error monitoring and reporting, which is used to solve the problem that there is no perfect monitoring mechanism in the prior art that can capture exceptions and report and type analyze the captured exceptions

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method for achieving Script error monitoring and reporting
  • Method for achieving Script error monitoring and reporting
  • Method for achieving Script error monitoring and reporting

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0032] combined with figure 1 As shown, a method for realizing Script error monitoring and reporting includes:

[0033] Step S100: Capture exception information, which includes JS runtime errors, unhandled Promise errors, resource loading exception errors, and interface errors, specifically including:

[0034] Use window.onerror monitoring and function window.addEventListener('error') to capture JS runtime error types, where window.onerror contains detailed error information error.stack;

[0035] Use the function window.addEventListener('unhandledrejection') to capture unhandled promise errors;

[0036] Use window.addEventListener('error') to capture resource loading exception errors;

[0037] Capture global interface errors by encapsulating xmlHttpRequest or fetch functions.

[0038] Step S200: Report the captured abnormal information to the collection platform, including:

[0039] Step S210: When the abnormal information is captured, first construct an error object, and ...

Embodiment 2

[0046] On the basis of Embodiment 1, the step S230 specifically includes:

[0047] Step S231: Adding a crossorigin attribute to the script tag on the page. After adding the crossorigin attribute, the browser will automatically add an Origin field to the request header to initiate a cross-origin resource sharing request. Origin indicates the source of the request to the server, and the server will judge whether it responds normally according to the source;

[0048] Step S232: Add Access-Control-Allow-Origin to the response header to support cross-domain resource sharing. Access-Control-Allow-Origin: * indicates that the cross-domain request is passed, and the resource can be accessed by any site. And when the resource only allows cross-site requests from http: / / 127.0.0.1:8066, and other sites cannot cross-site access, it will be able to return;

[0049] Step S233: Vary:Origin needs to be included in the response header of Access-Control-Allow-Origin of the domain name. The ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a method for achieving Script error monitoring and reporting, which comprises the following steps that: capturing abnormal information, wherein the abnormal information comprises an error during JS operation, an unprocessed Promise error, a resource loading abnormal error and an interface error; when abnormal information is captured, constructing an error object, and transmitting the abnormal information to the interface; newly building an object xhr, and then utilizing an open function of the xhr to send the object xhr to a node middle layer; setting a request header, and capturing specific error reporting information; and analyzing the specific error reporting information, and reporting the abnormal information to a background server. In order to achieve better performance and user experience, error monitoring of front-end projects should be matched, script error monitoring serves as an important link in monitoring, and when an error is reported to a page, existing problems can be found in time by reporting error information, repair and optimization are achieved, and losses are reduced.

Description

technical field [0001] The invention relates to the technical field of web application monitoring, specifically, a method for realizing script error monitoring and reporting. Background technique [0002] With the rise of web development, many applications are now displayed to users in the form of web applications. Regardless of the popular H5 and small programs, they all belong to the category of front-end development. However, an excellent web project must not only provide a good user experience under normal circumstances, but also consider how to quickly locate and solve problems when the system reports errors. Only by quickly locating the problem and solving the problem can the user basically not feel that the system reports an error but a very smooth normal experience. However, a project that has undergone a lot of testing and joint debugging still has very hidden defects. Therefore, for the front-end that directly faces users, exception capture and reporting are cruc...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F11/30G06F11/36
CPCG06F11/302G06F11/3612G06F11/366
Inventor 刘强
Owner SICHUAN CHANGHONG ELECTRIC CO LTD