Reflections on OS integration Eric Schrock's Weblog
Musings about Fishworks, Operating Systems, and the software that runs on them.

AJAX Debugging support

This page desmontrates how to effectively debug AJAX applications in production, using features of the browser to generate and preserve stack trace information to better understand the source of errors.

Current support across browsers.

BrowserEvent MessageFile LineStack
Firefox 3.0.5window.onerror XX1 X1
DOM exception X X X
runtime exception X X X X
user exception - X2
IE7.0.5730.13window.onerror XX X
DOM exception X
runtime exception X
user exception -
Safari 3.2.1window.onerror
DOM exception X X X
runtime exception X X X
user exception - X X
Chrome 1.0.154.36window.onerror
DOM exception X
runtime exception X
user exception -
Opera 9.63window.onerror
DOM exception X X X3
runtime exception X X
user exception - X3

Notes

  1. DOM errors in firefox do not have an explicit file and line number, but the information is buried within the message.
  2. Arbitrary exceptions do not have stack traces of Firefox, but those that use the Error() constructor do.
  3. Opera can be configured to generate stack traces for exceptions, but it is not enabled by default.

Examples

Browser Vendor:
Browser Agent:

window.onerror

  • DOM error

  • Runtime error

  • User error

Caught exceptions

  • DOM error

  • Runtime error

  • Generic error

Alternate contexts

  • setTimeout()

  • addEventListener()

    Click me!