ISO a taxonomy of AJAX errors

Discussion in 'Javascript' started by kj, Jan 29, 2008.

  1. kj

    kj Guest

    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.
    kj, Jan 29, 2008
    #1
    1. Advertising

  2. 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
    Bart Van der Donck, Jan 30, 2008
    #2
    1. Advertising

  3. kj

    kj Guest

    In <> Bart Van der Donck <> 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.
    kj, Jan 31, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Franck DARRAS
    Replies:
    12
    Views:
    622
    Jim Higson
    Aug 23, 2004
  2. Alexei Polkhanov
    Replies:
    11
    Views:
    2,445
  3. ej
    Replies:
    3
    Views:
    304
    Francois
    Mar 22, 2006
  4. Calvin Spealman
    Replies:
    0
    Views:
    446
    Calvin Spealman
    Aug 12, 2008
  5. Irving Kimura
    Replies:
    2
    Views:
    231
    Tassilo v. Parseval
    Jan 30, 2004
Loading...

Share This Page