Updating logging on transport failure (#12026)

This commit is contained in:
Mikael Mengistu 2019-07-15 13:20:35 -07:00 committed by GitHub
parent 09722d1ce5
commit a784f4575b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -80,7 +80,10 @@ export class WebSocketTransport implements ITransport {
// ErrorEvent is a browser only type we need to check if the type exists before using it
if (typeof ErrorEvent !== "undefined" && event instanceof ErrorEvent) {
error = event.error;
} else {
error = new Error("There was an error with the transport.");
}
reject(error);
};

View File

@ -213,12 +213,14 @@ describe("HttpConnection", () => {
const connection = new HttpConnection("http://tempuri.org", options);
await expect(connection.start(TransferFormat.Text))
.rejects
.toThrow("Unable to connect to the server with any of the available transports. WebSockets failed: null ServerSentEvents failed: Error: 'ServerSentEvents' is disabled by the client. LongPolling failed: Error: 'LongPolling' is disabled by the client.");
.toThrow("Unable to connect to the server with any of the available transports. WebSockets failed: Error: There was an error with the transport. " +
"ServerSentEvents failed: Error: 'ServerSentEvents' is disabled by the client. LongPolling failed: Error: 'LongPolling' is disabled by the client.");
expect(negotiateCount).toEqual(1);
},
"Failed to start the transport 'WebSockets': null",
"Failed to start the connection: Error: Unable to connect to the server with any of the available transports. WebSockets failed: null ServerSentEvents failed: Error: 'ServerSentEvents' is disabled by the client. LongPolling failed: Error: 'LongPolling' is disabled by the client.");
"Failed to start the transport 'WebSockets': Error: There was an error with the transport.",
"Failed to start the connection: Error: Unable to connect to the server with any of the available transports. WebSockets failed: Error: There was an error with the transport. " +
"ServerSentEvents failed: Error: 'ServerSentEvents' is disabled by the client. LongPolling failed: Error: 'LongPolling' is disabled by the client.");
});
it("negotiate called again when transport fails to start and falls back", async () => {

View File

@ -61,7 +61,7 @@ describe("WebSocketTransport", () => {
await expect(connectPromise)
.rejects
.toBeNull();
.toThrow("There was an error with the transport.");
expect(connectComplete).toBe(false);
});
});