Panic.js

Ever struggled with bugs in JavaScript? Then Panic.js is your instant best friend. Delivers better error diagnostics to Chrome, Safari and Firefox.

  1. Cross-platform uncaught exception handling (works around incomplete 'onerror' impl. in Safari).
  2. Maintains callstack persistence across async call boundaries (addEventListener, setTimeout).
  3. Loads and displays expandable source lines for fast identification.
  4. Hides third party code by default (can be displayed by pressing 'more').
  5. Grouping of message duplicates.
  6. Grouping of same source line repeated consequently.
  7. Complete API for it's internals (exception handling / callstack access) — TBD




Err... isn't this what debug tools are for?

Yes, and this is "debug tools" too, but more specific. It is not a replacement to WebInspector, but a power-up. WebInspector is just not good enough for the quick identification of typical errors that occur often during development process. In most cases, they require no detailed inspection of the full source code — you can identify problem cause just by briefly looking at the source line. Displaying full info, as WebInspector does, would slow down things: you need to scroll through tons of text, expand cryptic traces by clicking, and then clicking and waiting again to load sources in separate window. And because WebInspector is a separate tool, you might not even know that something's broken, until its opened. You can imagine Panic.js as a small and fast subset of WebInspector, inlined into your page until it goes to the production, like a scaffolding.

Configuring

Simply link the script to a page, and it will configure itself automagically™. Requires underscore and jQuery.

Panic.min.js (minified)
Panic.js (readable source)

Compatibility

Before use, consider that the distribution contains full Useless toolkit, where the diagnostics-related utility [responsible for all the magic behind Panic.js] appear a small fraction of entire codebase. In other words, it brings a holy shitload of code, which can possibly cause all sort of compatibility-related issues. But in most cases, it should work out of the box. And supposing that you don't ever plan using Panic.js on production server (why would you), size of the script doesn't matter that much.

Development

You can contribute to Panic here: github.com/xpl/useless. Currently it's a part of a larger framework, but eventually it will undergo separation to a stand-alone project, for everyone's convenience.

Limitations

Does not display source lines if executed from local HTML file (as sources are read by XHR requests).