Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > ISO a taxonomy of AJAX errors

Reply
Thread Tools

ISO a taxonomy of AJAX errors

 
 
kj
Guest
Posts: n/a
 
      01-29-2008



Hi. I'm *very* new to AJAX/AXAH, so please forgive me if the
following question sounds too stupid...

I'm in the process of designing the general error handling scheme
for a site that uses a fair bit of XHR-based communication with
its server. So I would like to know the various categories of
errors I can have, and to come up with the corresponding error
messages so that they are most helpful to the user.

I imagine that the most fundamental error that the application
could detect upon issuing an XHR would occur if the client machine
suddenly lost its connection to the network.

Next to that would be some DNS-type error that suddenly prevented
the client from finding the server ("server not found").

The next level of error would be when the server just fails to
respond at all (server down).

How can the client-side JavaScript code most easily distinguish
between those three possibilities?

Thanks!

Kynn

P.S. I realize that there are more types of errors possible beyond
the ones listed above, but once the server is able to respond then
the client program can rely on it to determine the nature of the
problem. The problem with the errors listed above is that the
client cannot use information from the server to disambiguate them.

--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
 
Reply With Quote
 
 
 
 
Bart Van der Donck
Guest
Posts: n/a
 
      01-30-2008
kj wrote:

> I'm in the process of designing the general error handling scheme
> for a site that uses a fair bit of XHR-based communication with
> its server. *So I would like to know the various categories of
> errors I can have, and to come up with the corresponding error
> messages so that they are most helpful to the user.
>
> I imagine that the most fundamental error that the application
> could detect upon issuing an XHR would occur if the client machine
> suddenly lost its connection to the network.
>
> Next to that would be some DNS-type error that suddenly prevented
> the client from finding the server ("server not found").
>
> The next level of error would be when the server just fails to
> respond at all (server down).
>
> How can the client-side JavaScript code most easily distinguish
> between those three possibilities?
>
> Thanks!
>
> Kynn
>
> P.S. I realize that there are more types of errors possible beyond
> the ones listed above, but once the server is able to respond then
> the client program can rely on it to determine the nature of the
> problem. *The problem with the errors listed above is that the
> client cannot use information from the server to disambiguate them.


You can use the 'status' and 'readyState' properties of the
XMLHttpRequest object:

http://www.w3schools.com/dom/dom_http.asp

Possible HTTP status codes:

http://en.wikipedia.org/wiki/List_of_HTTP_status_codes

For an example, see section if (xmlhttp.status==200)... at:

http://www.w3schools.com/xml/xml_http.asp

Hope this helps,

--
Bart
 
Reply With Quote
 
 
 
 
kj
Guest
Posts: n/a
 
      01-31-2008
In <(E-Mail Removed)> Bart Van der Donck <(E-Mail Removed)> writes:

>You can use the 'status' and 'readyState' properties of the
>XMLHttpRequest object:


> http://www.w3schools.com/dom/dom_http.asp


>Possible HTTP status codes:


> http://en.wikipedia.org/wiki/List_of_HTTP_status_codes


>For an example, see section if (xmlhttp.status=3D=3D200)... at:


> http://www.w3schools.com/xml/xml_http.asp


That's what I needed. Thanks!

kynn
--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Thesaurus / ontology / taxonomy Python library Calvin Spealman Python 0 08-12-2008 04:40 PM
NOT Python: Taxonomy list reference ej Python 3 03-22-2006 12:54 AM
Programmer's notebook: a taxonomy of error handling Irving Kimura Perl Misc 2 01-30-2004 07:55 AM



Advertisments