summaryrefslogtreecommitdiffhomepage
path: root/gui/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'gui/src/main')
-rw-r--r--gui/src/main/daemon-rpc.ts13
-rw-r--r--gui/src/main/errors.ts6
2 files changed, 17 insertions, 2 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts
index f17505bd80..2ef9feb99d 100644
--- a/gui/src/main/daemon-rpc.ts
+++ b/gui/src/main/daemon-rpc.ts
@@ -54,7 +54,7 @@ import log from '../shared/logging';
import { ManagementServiceClient } from './management_interface/management_interface_grpc_pb';
import * as grpcTypes from './management_interface/management_interface_pb';
-import { CommunicationError, InvalidAccountError } from './errors';
+import { CommunicationError, InvalidAccountError, TooManyDevicesError } from './errors';
const NETWORK_CALL_TIMEOUT = 10000;
const CHANNEL_STATE_TIMEOUT = 1000 * 60 * 60;
@@ -259,7 +259,16 @@ export class DaemonRpc {
}
public async loginAccount(accountToken: AccountToken): Promise<void> {
- await this.callString(this.client.loginAccount, accountToken);
+ try {
+ await this.callString(this.client.loginAccount, accountToken);
+ } catch (e) {
+ const error = e as grpc.ServiceError;
+ if (error.code == grpc.status.RESOURCE_EXHAUSTED) {
+ throw new TooManyDevicesError();
+ } else {
+ throw error;
+ }
+ }
}
public async logoutAccount(): Promise<void> {
diff --git a/gui/src/main/errors.ts b/gui/src/main/errors.ts
index 261ee7a164..b7cc82c365 100644
--- a/gui/src/main/errors.ts
+++ b/gui/src/main/errors.ts
@@ -15,3 +15,9 @@ export class CommunicationError extends Error {
super('api.mullvad.net is blocked, please check your firewall');
}
}
+
+export class TooManyDevicesError extends Error {
+ constructor() {
+ super('Too many devices');
+ }
+}