On my website, I have a reference to a javascript file, and on IE, this error is thrown:
send: function (data) {
/// <summary>Sends data over the connection</summary>
/// <param name="data" type="String">The data to send over the connection</param>
/// <returns type="signalR" />
var connection = this;
if (!connection.transport) {
// Connection hasn't been started yet
throw "SignalR: Connection must be started before data can be sent. Call .start() before .send()";
}
connection.transport.send(开发者_JAVA技巧connection, data);
return connection;
},
That throw
is being caught by Internet Explorer, and it appears to halt any other javascript from running.
What can I do so that error doesn't completely halt everything on my page?
Why are you using throw if you don't want to throw the exception? consider this, if you want the exception for logging purposes:
if (!connection.transport) {
// Connection hasn't been started yet
setTimeout(function() {
throw "SignalR: Connection must be started before data can be sent. Call .start() before .send()";
}, 0);
return;
}
精彩评论