DWR

Generate specific error when server connection lost

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 2.0.3
  • Fix Version/s: 4.0
  • Component/s: None
  • Description:
    Hide
    When DWR loses its connection to a server it throws a generic error. Would it be possible to detect this condition and throw a specific error? As things are now, it appears impossible to know if the error was caused by "connection lost" or some other reason.
    Show
    When DWR loses its connection to a server it throws a generic error. Would it be possible to detect this condition and throw a specific error? As things are now, it appears impossible to know if the error was caused by "connection lost" or some other reason.

Activity

Hide
Joe Walker added a comment - 17/Apr/08 12:47 PM

Are you talking about the reverse-ajax case, or any connection?

DWR itself doesn't throw any exceptions on connection lost - it does however call the errorHandler, and it includes information about the cause of the error as it does this.

Show
Joe Walker added a comment - 17/Apr/08 12:47 PM Are you talking about the reverse-ajax case, or any connection? DWR itself doesn't throw any exceptions on connection lost - it does however call the errorHandler, and it includes information about the cause of the error as it does this.
Hide
Travis Haagen added a comment - 17/Apr/08 4:32 PM

I'm referring to any connection (not reverse-ajax). The Object that is returned within Firefox 2 is the following. How can I tell from this object that a "connection lost" occurred as opposed to some other problem? Please let me know if you need more information.

[Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://localhost/dwr/engine.js :: anonymous :: line 812" data: no]

Show
Travis Haagen added a comment - 17/Apr/08 4:32 PM I'm referring to any connection (not reverse-ajax). The Object that is returned within Firefox 2 is the following. How can I tell from this object that a "connection lost" occurred as opposed to some other problem? Please let me know if you need more information. [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://localhost/dwr/engine.js :: anonymous :: line 812" data: no]
Hide
Joe Walker added a comment - 17/Apr/08 5:33 PM

So you're saying that you do:

try {
Remote.method(params...);
}
catch (ex) {
console.debug(ex);
}

And you get the above?

Show
Joe Walker added a comment - 17/Apr/08 5:33 PM So you're saying that you do: try { Remote.method(params...); } catch (ex) { console.debug(ex); } And you get the above?
Hide
Travis Haagen added a comment - 17/Apr/08 6:42 PM

I'm using the following technique. The Exception above is actually being sent to the 'warningHandler' callback.

function sendNote() {
Note.notify(sTicket, {
callback:function(bFlag)
{ alert("Still connected."); },
exceptionHandler:function(exception)
{ communicationError(exception); },
errorHandler:function(errorString, exception)
{ communicationError(exception); },
warningHandler:function(errorString, exception)
{ communicationError(exception); } }
});
}

Show
Travis Haagen added a comment - 17/Apr/08 6:42 PM I'm using the following technique. The Exception above is actually being sent to the 'warningHandler' callback. function sendNote() { Note.notify(sTicket, { callback:function(bFlag) { alert("Still connected."); }, exceptionHandler:function(exception) { communicationError(exception); }, errorHandler:function(errorString, exception) { communicationError(exception); }, warningHandler:function(errorString, exception) { communicationError(exception); } } }); }

People

Dates

  • Created:
    16/Apr/08 5:47 PM
    Updated:
    01/Dec/09 7:00 PM