PDA

View Full Version : Errorhandling in FF



Anders Ohrt
5-Jun-2007, 12:37 AM
A little now and then I got a strange error reported by Firebug. It seems
that if a network problem occurs during an Ajax call, you are not allowed to
even look at the status property. The error is the following:

[Exception... "Component returned failure code: 0x80040111
(NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111
(NS_ERROR_NOT_AVAILABLE)" location: "JS frame ::
http://localhost/SolMaster/Include/VdfAjaxLib/XmlRequest.js :: anonymous ::
line 106" data: no]

The error occurs on this line:

if(this.oLoader.status < 300 || this.oLoader.status == 500){

I added a try-catch around the six lines (106 - 111) and was able to get a
status 221, "could not parse xml response". I don't know why yet, but
atleast it's a nicer error to report than the 0x80040111. =)

// Anders

Edwin van der Velden
5-Jun-2007, 04:25 AM
I'm not sure why it does that either, when javascript comes with that kind
of errors I think it just stops in the middle of some underwater function
and never returns even a proper error code. The other day I had a simple
..focus() inside a try..catch statement, but it still gave me a three line
long big red error message in firebug and was never caught.

In this case it does seem to help to put it inside a try..catch, so I can at
least ad that change for the next release :-)


-Edwin


"Anders Öhrt" <Anders.Ohrt@berendsen.se> wrote in message
news:Q7gkpOzpHHA.5572@dacmail.dataaccess.com...
>
> A little now and then I got a strange error reported by Firebug. It seems
> that if a network problem occurs during an Ajax call, you are not allowed
> to even look at the status property. The error is the following:
>
> [Exception... "Component returned failure code: 0x80040111
> (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111
> (NS_ERROR_NOT_AVAILABLE)" location: "JS frame ::
> http://localhost/SolMaster/Include/VdfAjaxLib/XmlRequest.js :: anonymous
> :: line 106" data: no]
>
> The error occurs on this line:
>
> if(this.oLoader.status < 300 || this.oLoader.status == 500){
>
> I added a try-catch around the six lines (106 - 111) and was able to get a
> status 221, "could not parse xml response". I don't know why yet, but
> atleast it's a nicer error to report than the 0x80040111. =)
>
> // Anders
>