summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/main/daemon-rpc.ts11
-rw-r--r--gui/src/main/index.ts24
2 files changed, 7 insertions, 28 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts
index ff0c81a707..055fadc4ef 100644
--- a/gui/src/main/daemon-rpc.ts
+++ b/gui/src/main/daemon-rpc.ts
@@ -264,10 +264,13 @@ export class DaemonRpc {
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;
+ switch (error.code) {
+ case grpc.status.RESOURCE_EXHAUSTED:
+ throw new TooManyDevicesError();
+ case grpc.status.UNAUTHENTICATED:
+ throw new InvalidAccountError();
+ default:
+ throw new CommunicationError();
}
}
}
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index b1f7f44b8a..da8f3afffb 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -107,8 +107,6 @@ enum AppQuitStage {
ready,
}
-type AccountVerification = { status: 'verified' } | { status: 'deferred'; error: Error };
-
class ApplicationMain {
private notificationController = new NotificationController({
openApp: () => this.windowController?.show(),
@@ -1481,12 +1479,6 @@ class ApplicationMain {
private async login(accountToken: AccountToken): Promise<void> {
try {
- const verification = await this.verifyAccount(accountToken);
-
- if (verification.status === 'deferred') {
- log.warn(`Failed to get account data, logging in anyway: ${verification.error.message}`);
- }
-
await this.daemonRpc.loginAccount(accountToken);
} catch (e) {
const error = e as Error;
@@ -1534,22 +1526,6 @@ class ApplicationMain {
}
}
- private verifyAccount(accountToken: AccountToken): Promise<AccountVerification> {
- return new Promise((resolve, reject) => {
- this.accountDataCache.invalidate();
- this.accountDataCache.fetch(accountToken, {
- onFinish: () => resolve({ status: 'verified' }),
- onError: (error) => {
- if (error instanceof InvalidAccountError) {
- reject(error);
- } else {
- resolve({ status: 'deferred', error });
- }
- },
- });
- });
- }
-
private updateAccountDataOnAccountChange(oldAccount?: string, newAccount?: string) {
if (oldAccount && !newAccount) {
this.accountDataCache.invalidate();