Skip to content

Commit

Permalink
Whenever we fail at parsing a response from the server we trigger the…
Browse files Browse the repository at this point in the history
… error handler and stop the connection.

#2506
  • Loading branch information
NTaylorMullen committed Nov 5, 2013
1 parent 3753bab commit b5831f8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
}
catch (error) {
deferral.reject("Failed to parse ping server response, stopping the connection: " + result);
connection.stop();
return;
}

Expand Down Expand Up @@ -224,6 +225,7 @@
}
catch (error) {
onFail(error, connection);
connection.stop();
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,18 @@
// reconnected quickly
reconnectErrors = 0;

// If there's currently a timeout to trigger reconnect, fire it now before processing messages
if (privateData.reconnectTimeoutId !== null) {
fireReconnected();
}

try {
minData = connection._parseResponse(result);
}
catch (error) {
$(connection).triggerHandler(events.onError, ["SignalR: failed at parsing response: " + result + ". With error: " + error.message]);
connection.stop();
return;
}

// If there's currently a timeout to trigger reconnect, fire it now before processing messages
if (privateData.reconnectTimeoutId !== null) {
fireReconnected();
}

fireConnect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
}
catch (error) {
$(connection).triggerHandler(events.onError, ["SignalR: failed at parsing response: " + e.data + ". With error: " + error.message]);
connection.stop();
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
}
catch (error) {
$connection.triggerHandler(events.onError, ["SignalR: failed at parsing response: " + event.data + ". With error: " + error.message]);
connection.stop();
return;
}

Expand Down

0 comments on commit b5831f8

Please sign in to comment.