开发者

How can I log Javascript errors and report them without using Javascript?

My webapp currently employs a JS based error logging system for reporting JS error on the client side. The problem with logging your error using javascript is jus开发者_StackOverflow社区t that - we are using a technology to monitor problems in that same technology. Easily an error in the JS could prevent the logging from occuring.

I was wondering if anyone has an idea how we could log and report client side errors without relying on out own Javascript code.

thanks


Nope. But you can use a try / catch block to get out of javascript error that would otherwise stop execution.

try {
  stuff.that('raises').error();
} catch(e) {
  // send e via ajax
}


we are using a technology to monitor problems in that same technology

Don't we always do that. Have you ever done error and exception handling in a language other than the one you're working with?

Use window.onerror callback. Will also catch syntax errors. Or try catching the error as @Squeegy suggests.


Unfortunately, I don't believe that is possible. You will have to use javascript in some form to catch and report the errors, whether it be sending an ajax request, or having users submit a form with the errors in a textbox.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜