« archives

April 2007
S M T W T F S
« Mar   May »
1234567
891011121314
15161718192021
22232425262728
2930  

recently

news from around the web

» view all

Archive for April 24th, 2007


Javascript selectedIndex NS_ERROR_FAILURE in Firefox

Tuesday, April 24th, 2007

I was amazed that the top hit in Google for this was the Mozilla source code (which was helpful, but not very user-friendly) so I’m writing up a bit on this confusing error message.

This is a Mozilla (Firefox, Seamonkey, Ephiphany, etc.) exception that gets thrown when you try to set the selectedIndex of a select element out of bounds of its options. The error message (from Firebug) looks like:

uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMHTMLSelectElement.selectedIndex]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://www.example.com/test.html :: testSelect :: line 8" data: no]

This is not your standard JavaScript error. It’s not informative, useful, user-friendly, and barely gives you a line number to work with.

Read the rest of this entry »