14th Chapter error Handling and debugging
1. Open Browser Error report
1.1 Internet Explorer
-toos→internet Option→anvanced→display A notification about every script error
1.2 Firefox
-tools→error Console (Firebug)
1.3 Safari
-edit→preferences→advanced→show develop menu in Menubar/develop→show
the data is sent to the server. For example:Www.cnblogs.com?backurl=http://www.cnblogs.com?a=1 The workaround is to encode the parameters following the Backurl using encodeURIComponent (), with the result:Www.cnblogs.com?backurl= HTTP%3A%2F%2FWWW.CNBLOGS.COM%3FA%3D1Scenario two is for the query string, and also for the name and value of the query parameter are encoded.Four logging errors to the serverIf the error information in the front and back end
1.Error () constructorWhen JavaScript parses or executes a statement, the JS engine throws it whenever an error occurs!JavaScript primitives provide the error () constructor , and all thrown errors are instances of this constructor (that is, objects ).1 var err1=New
For JavaScript errors, such as XXX undefined,syntaxerror, we are more familiar with, this article we discuss how the JavaScript error capture.Our team names the wrong JavaScript code as BADJS, and there is an open source Badjs project that captures and analyzes JS errors and provides some basic analysis of report data.
How to capture and analyze JavaScript Error
Front-end engineers know that JavaScript has basic exception handling capabilities. We can throw the new error () and the browser throws an exception when we invoke the API error. But it is estimated that most front-end engineers
Front-end engineers know that JavaScript has basic exception handling capabilities. We can throw the new error () and the browser will throw an exception when we call the API error. But it is estimated that most front-end engineers have not considered collecting these anomaly information.Anyway, as long as the JavaScript
This article mainly describes how to capture and analyze JavaScript Error, interested friends can refer to the following How to capture and analyze JavaScript errornbsp; nbsp; Front-End engineers know that JavaScript has basic exception handling capabilities. We can throw the new
Error object can be used as a prototype for user-defined Error object inheritance.The Error.prototype object contains the following properties:
Constructor– a constructor that points to an instance
message– error message
name– wrong name (type)
These a
JavaScript Step error HandlingIf you are familiar with the error features of the kettle conversion, you may want to know how to use it in JavaScript steps. Steps to support the error mechanism the user interface mechanism is the same, right-click on the
error handling mechanism of the browser, the function must return true. The code example references an error-handling demo.
3. Error handling Demo program (handling Demo)
Q: can I dynamically change JavaScript's error handlers?
A: That 's OK. To change the JavaScript
// REALRUNINTHISCONTEXTSCR IPT (vm.js:22:35) at siginthandlerswrap (vm.js:98:12) at ContextifyScript.Script.runInThisContext (vm.js:24:12) at replserver.defaulteval (repl.js: 313:29) at bound (domain.js:280:14) at Replserver.runbound [as Eval] (domain.js: 293:12) at replserver.online (repl.js:513:10)Error objects and Errors handlingAn Error object is usually thrown when a program runs out
ObjectiveThis article is my Learning JavaScript process in the collection and collation of some of the error-prone knowledge points, will be from the scope of variables, type comparison, this point, function parameters, closure problems and object copy and assignment of these 6 aspects of the introduction and interpretation of the easy-to-digest, which also involved some ES6 knowledge points.JavaScript know
ObjectiveThis article is my Learning JavaScript process in the collection and collation of some of the error-prone knowledge points, will be from the scope of variables, type comparison, this point, function parameters, closure problems and object copy and assignment of these 6 aspects of the introduction and interpretation of the easy-to-digest, which also involved some ES6 knowledge points.JavaScript know
ObjectiveThis article is my Learning JavaScript process in the collection and collation of some of the error-prone knowledge points, will be from the scope of variables, type comparison, this point, function parameters, closure problems and object copy and assignment of these 6 aspects of the introduction and interpretation of the easy-to-digest, which also involved some ES6 knowledge points.JavaScript know
Common javascript error object processing, Error code set error object
Property:
Name: Error name
Number: error number
Description: description
Message:
Anyway, as long as the JavaScript error after the refresh is no longer, the user can solve the problem by refreshing, the browser will not crash, when it did not happen well. This assumption was established before the single Page App was popular. Now the single Page APP runs for a period of time after a very complex state, the user may have a number of input operations to come here, said refresh on the refr
Front-end engineers know that JavaScript has basic exception handling capabilities. We can throw the new error () and the browser throws an exception when we invoke the API error. But it is estimated that most front-end engineers have not considered collecting these exception information.
Anyway, as long as the JavaScript
line won't be executed");}//When a exception occurs, the control is transferred to the CATCH blockCatch(e) {document.write ("Description =" + E.description + "[br/]"); document.write ("Message =" + E.message + "[br/]"); document.write ("Stack =" + E.stack + "[br/][br/]");}finally{document.write (Guaranteed to execute);}Output:javascript Try Catch finally Example.pngThe formatting errors and exceptions in JavaScri
two errors are similar. When the statement is too long, it will happen. Of course, these are also very easy to find .)
5.The plus sign is missing when the string is connected.(+)
This type of error is easy to detect in a short time, but it will be very troublesome if it is too long, and different browser Error alerts are different. for ie browsers, the message
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.