开发者

How to deal with the errors that are caused by users in javascript web applications?

开发者 https://www.devze.com 2023-03-18 16:40 出处:网络
For example, in PHP or other server side programs, I can save all errors which caused by users to the server.

For example, in PHP or other server side programs, I can save all errors which caused by users to the server.

And I can know if errors occurred or not and can fix them.

But in web applications using javascript, I don't know what errors are caused by users.

And I can not fix them.

How to save errors of javascript web applications to the server to know and fix them?

And saving javascript errors to the server is a common and effective approach?

Or are there开发者_JAVA技巧 better approaches to deal with the problem?

How do many "javascript web application developers" know and fix the errors of their published javascript web applications?

Or shouldn't I worry about the errors caused by users?


Javascript also has try/catch blocks that you can use to trap errors and submit to server.

Not every error is worth saving to server. Based on the severity of error, you need to decide which ones to save/log and which ones to handle differently.

E.g., number validation is something that you can display to user via alert() or highlighted error spans/divs; whereas if password validation fails for n number of times, you might want to log the incoming IP address and other data that lets you audit your system for potential breaches.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号