This repository was archived by the owner on Jan 21, 2024. It is now read-only.

Description
I came up with a clever technique a few months ago that I wanted to try out... turns out to be a win but only in Firefox (so far as I've seen):
http://jsfiddle.net/JamesMGreene/MYgpY/
Basically you override the Error.prototype.toString method to store a reference to that Error so that you can access it again during the window.onerror handler even if the 5th error argument does not exist. This works on the notion that the browsers would invoke the toString (or valueOf) method when getting the string to pass as the 1st message argument to window.onerror; however, it turns out that this assumption is only currently valid in Firefox (as far as major browsers go, anyway)... the others seem to utilize some internal conversion approach instead. Either way, it's easy to feature test and can be a big win in Firefox.