Prev: Frames - no scrollbar
Next: errore
From: Peter Michaux on 5 Dec 2006 12:44 Prasad wrote: > But it's giving exception in mozilla/firefox when I stopped the server > (only when I stop .), > > at line 65 in my code, as > > > [Exception... "Component returned failure code: 0x80040111 > (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: > "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: > http://localhost/teamkollab/chat2/chat-ajax.js :: responseDisplayChat > :: line 65" data: no] > > > line 65 is > -------------- if(xmlhttp.status != 200) > > I could not access the xmlhttp.status variable . > > Does it mean that xmlhttp object won't be returned with status code > when it can not connect to a page ?? > If yes, what will it return to know the status ?? > > > How could I solve this to not to get such exception ? The Yahoo! UI connection manager (http://developer.yahoo.com/yui/connection/) puts the xmlhttp.status line in a try-catch block because of Firefox try { if(o.conn.status !== undefined && o.conn.status != 0){ httpStatus = o.conn.status; } else{ httpStatus = 13030; } } catch(e){ // 13030 is the custom code to indicate the condition -- in Mozilla/FF -- // when the o object's status and statusText properties are // unavailable, and a query attempt throws an exception. httpStatus = 13030; } I haven't had a chance to study this more and their documentation unfortunately doesn't specify what conditions calse the unavailability. Flanagan's fifth edition simply states that reading the status when readystate is less than 3 causes an error. Since XHR is not standardized I imagine it was one of his observations in a particular browser. Peter
From: Prasad on 6 Dec 2006 09:48 Peter Michaux wrote: > Prasad wrote: > > > But it's giving exception in mozilla/firefox when I stopped the server > > (only when I stop .), > > > > at line 65 in my code, as > > > > > > [Exception... "Component returned failure code: 0x80040111 > > (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: > > "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: > > http://localhost/teamkollab/chat2/chat-ajax.js :: responseDisplayChat > > :: line 65" data: no] > > > > > > line 65 is > > -------------- if(xmlhttp.status != 200) > > > > I could not access the xmlhttp.status variable . > > > > Does it mean that xmlhttp object won't be returned with status code > > when it can not connect to a page ?? > > If yes, what will it return to know the status ?? > > > > > > How could I solve this to not to get such exception ? > > The Yahoo! UI connection manager > (http://developer.yahoo.com/yui/connection/) puts the xmlhttp.status > line in a try-catch block because of Firefox > > try > { > if(o.conn.status !== undefined && o.conn.status != 0){ > httpStatus = o.conn.status; > } > else{ > httpStatus = 13030; > } > } > catch(e){ > // 13030 is the custom code to indicate the condition -- in > Mozilla/FF -- > // when the o object's status and statusText properties are > // unavailable, and a query attempt throws an exception. > httpStatus = 13030; > } > > I haven't had a chance to study this more and their documentation > unfortunately doesn't specify what conditions calse the unavailability. > Thanks,some how , I got rid of the problem ,but am still wondering why it's giving exception when we are reading status variable ("only when browser can't get any response from server ") . Doesn't it mean that it's bug with firefox ?? Anyways , Thanks a lot .. > Flanagan's fifth edition simply states that reading the status when > readystate is less than 3 causes an error. Since XHR is not > standardized I imagine it was one of his observations in a particular > browser. > > Peter
From: Prasad on 6 Dec 2006 09:50 Peter Michaux wrote: > Prasad wrote: > > > But it's giving exception in mozilla/firefox when I stopped the server > > (only when I stop .), > > > > at line 65 in my code, as > > > > > > [Exception... "Component returned failure code: 0x80040111 > > (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: > > "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: > > http://localhost/teamkollab/chat2/chat-ajax.js :: responseDisplayChat > > :: line 65" data: no] > > > > > > line 65 is > > -------------- if(xmlhttp.status != 200) > > > > I could not access the xmlhttp.status variable . > > > > Does it mean that xmlhttp object won't be returned with status code > > when it can not connect to a page ?? > > If yes, what will it return to know the status ?? > > > > > > How could I solve this to not to get such exception ? > > The Yahoo! UI connection manager > (http://developer.yahoo.com/yui/connection/) puts the xmlhttp.status > line in a try-catch block because of Firefox > > try > { > if(o.conn.status !== undefined && o.conn.status != 0){ > httpStatus = o.conn.status; > } > else{ > httpStatus = 13030; > } > } > catch(e){ > // 13030 is the custom code to indicate the condition -- in > Mozilla/FF -- > // when the o object's status and statusText properties are > // unavailable, and a query attempt throws an exception. > httpStatus = 13030; > } > > I haven't had a chance to study this more and their documentation > unfortunately doesn't specify what conditions calse the unavailability. > > Flanagan's fifth edition simply states that reading the status when > readystate is less than 3 causes an error. Since XHR is not > standardized I imagine it was one of his observations in a particular > browser. > > Peter
From: VK on 6 Dec 2006 10:12 Prasad wrote: > Thanks,some how , I got rid of the problem ,but am still wondering why > it's giving exception when we are reading status variable ("only when > browser can't get any response from server ") . Doesn't it mean that > it's bug with firefox ?? Difficult to say. I mean it's already filed, but still seems discussed either call it a "bug" or hell on it and so promote it into "feature" :-) See <https://bugzilla.mozilla.org/show_bug.cgi?id=238559>, Comment #2 explains your particular case.
From: VK on 6 Dec 2006 10:21 VK wrote: > See <https://bugzilla.mozilla.org/show_bug.cgi?id=238559>, Comment #2 > explains your particular case. Respectively on async calls you should always check .status inside try{} block. On a network error IE will report the relevant status code by MS tables (linked in the bug thread) while Gecko will simply raise an exception you have to catch and interprete then as "Some network error happened". In this aspect I see the YI script as error prone.
|
Pages: 1 Prev: Frames - no scrollbar Next: errore |