diff --git a/client/src/www/app/app.ts b/client/src/www/app/app.ts index faad30953f..2892e6f3d1 100644 --- a/client/src/www/app/app.ts +++ b/client/src/www/app/app.ts @@ -220,6 +220,8 @@ export class App { }; } else if (error instanceof errors.SessionConfigError) { toastMessage = error.message; + } else if (error instanceof errors.SessionProviderError) { + return alert(error.message); } else { const hasErrorDetails = Boolean(error.message || error.cause); toastMessage = this.localize('error-unexpected'); diff --git a/client/src/www/app/outline_server_repository/access_key_serialization.ts b/client/src/www/app/outline_server_repository/access_key_serialization.ts index a3c57f7b97..362c1866ae 100644 --- a/client/src/www/app/outline_server_repository/access_key_serialization.ts +++ b/client/src/www/app/outline_server_repository/access_key_serialization.ts @@ -40,7 +40,7 @@ function parseShadowsocksSessionConfigJson(responseBody: string): ShadowsocksSes const responseJson = JSON.parse(responseBody); if ('error' in responseJson) { - throw new errors.SessionConfigError(responseJson.error.message); + throw new errors.SessionProviderError(responseJson.error.message); } const {method, password, server, server_port, prefix} = responseJson; diff --git a/client/src/www/model/errors.ts b/client/src/www/model/errors.ts index adc49d79a3..e763f60050 100644 --- a/client/src/www/model/errors.ts +++ b/client/src/www/model/errors.ts @@ -51,6 +51,12 @@ export class SessionConfigError extends CustomError { } } +export class SessionProviderError extends CustomError { + constructor(message: string) { + super(message); + } +} + export class ServerAccessKeyInvalid extends CustomError { constructor(message: string, options?: {cause?: Error}) { super(message, options);