Skip to content

Commit 895afb2

Browse files
committed
Added FailedToStartTransportError
1 parent f1dbafc commit 895afb2

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

src/Components/Web.JS/dist/Release/blazor.server.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Web.JS/dist/Release/blazor.webview.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Web.JS/src/Boot.Server.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ async function initializeConnection(options: CircuitStartOptions, logger: Logger
132132
unhandledError(connection, ex, logger);
133133

134134
if (ex.message.includes('UnsupportedTransportWebSocketsError')) {
135-
showErrorNotification('Unable to connect, please ensure you are using an updated browser and WebSockets are available.');
135+
showErrorNotification('Unable to connect, please ensure you are using an updated browser that supports WebSockets.');
136+
} else if (ex.message.includes('FailedToStartTransportWebSocketsError')) {
137+
showErrorNotification('Unable to connect, please ensure WebSockets are available. A VPN or proxy may be blocking the connection.');
136138
}
137139
}
138140

src/SignalR/clients/ts/signalr/src/HttpConnection.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ export class HttpConnection implements IConnection {
393393
} catch (ex) {
394394
this._logger.log(LogLevel.Error, `Failed to start the transport '${endpoint.transport}': ${ex}`);
395395
negotiate = undefined;
396-
transportExceptions.push(`${endpoint.transport} failed: ${ex}`);
396+
transportExceptions.push(new FailedToStartTransportError(`${endpoint.transport} failed: ${ex}`, endpoint.transport));
397397

398398
if (this._connectionState !== ConnectionState.Connecting) {
399399
const message = "Failed to select transport before stop() was called.";
@@ -447,9 +447,7 @@ export class HttpConnection implements IConnection {
447447
if ((transport === HttpTransportType.WebSockets && !this._options.WebSocket) ||
448448
(transport === HttpTransportType.ServerSentEvents && !this._options.EventSource)) {
449449
this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it is not supported in your environment.'`);
450-
const unsupportedTransportError = new Error(`'${HttpTransportType[transport]}' is not supported in your environment.`);
451-
unsupportedTransportError.name = `UnsupportedTransport${HttpTransportType[transport]}Error`;
452-
return unsupportedTransportError;
450+
return new UnsupportedTransportError(`'${HttpTransportType[transport]}' is not supported in your environment.`, HttpTransportType[transport]);
453451
} else {
454452
this._logger.log(LogLevel.Debug, `Selecting transport '${HttpTransportType[transport]}'.`);
455453
try {
@@ -652,6 +650,20 @@ export class TransportSendQueue {
652650
}
653651
}
654652

653+
class UnsupportedTransportError extends Error {
654+
constructor(public message: string, transport: string) {
655+
super(message);
656+
this.name = `UnsupportedTransport${transport}Error`;
657+
}
658+
}
659+
660+
class FailedToStartTransportError extends Error {
661+
constructor(public message: string, transport: string) {
662+
super(message);
663+
this.name = `FailedToStartTransport${transport}Error`;
664+
}
665+
}
666+
655667
class PromiseSource {
656668
private _resolver?: () => void;
657669
private _rejecter!: (reason?: any) => void;

0 commit comments

Comments
 (0)