Ajaxian covers a post on logging client-side errors on the server-side using AJAX. A commenter made mention of inconsistent behaviour when using the
onerror event as detailed on PPK.
In determining the issue, I noticed what appeared to be the issue and left the following comment on Ajaxian:
For example, trying to run
myfunction()where myfunction doesn't exist will trigger onerror. But running
myfunction(where there's a missing bracket will not trigger it.
In actuality, upon further testing, this seems to be incorrect. PPK's test case definitely demonstrates something peculiar with the
onerror but in any of the test cases I created, I was able to trigger
onerror whether it was a syntax or runtime error. My suspicion at this point lies in the fact that PPK's test case expects the error handler to pass in the event object. It would appear that
onerror actually passes in the error message, file name and line number as parameters instead.