Faq on JS Errors

M

MC

Thats a nice FAQ but it doesn't really help too much. How would you capture
js errors after the page has loaded? If I knew that, I could send them back
to a server via ajax and record them, so they could be fixed.

Any ideas on that?
MC
 
P

Peter Michaux

Thats a nice FAQ

Which FAQ?
but it doesn't really help too much. How would you capture
js errors after the page has loaded? If I knew that, I could send them back
to a server via ajax and record them, so they could be fixed.

This is not a frequent question.
Any ideas on that?

try-catch

Peter
 
M

MC

Peter Michaux said:
Which FAQ?


This is not a frequent question.


try-catch

Peter

So there is no error stack that I can access?
Something like document.error[0]....?
MC
 
T

Thomas 'PointedEars' Lahn

slebetman said:
Try handling the error event:

window.onerror = function (err,url,lineNumber) {
sendByAjax(err+", at:"+url+", line:"+lineNumber);
}

see:

http://developer.mozilla.org/en/docs/DOM:window.onerror

The onerror event handler is proprietary and unreliable. Therefore it
should only serve as a fallback for exception handling.

It should also be noted that syntax errors cannot be handled either way.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,141
Messages
2,570,814
Members
47,360
Latest member
kathdev

Latest Threads

Top