diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-01-02 17:38:13 -0600 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2023-01-02 17:38:13 -0600 |
commit | f6a0e634d78eb97d1d877033bf620ea982038731 (patch) | |
tree | 5d6b7ccbc8f6a587c3910c760bceeefda0c0a291 /src/state/models/session.ts | |
parent | 99cec71ed798b29079eb474acd6f7cc799b51a51 (diff) | |
download | voidsky-f6a0e634d78eb97d1d877033bf620ea982038731.tar.zst |
Implement logging system
Diffstat (limited to 'src/state/models/session.ts')
-rw-r--r-- | src/state/models/session.ts | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/state/models/session.ts b/src/state/models/session.ts index febffcec3..3efb5d2a6 100644 --- a/src/state/models/session.ts +++ b/src/state/models/session.ts @@ -121,11 +121,11 @@ export class SessionModel { try { const serviceUri = new URL(this.data.service) this.rootStore.api.xrpc.uri = serviceUri - } catch (e) { - console.error( + } catch (e: any) { + this.rootStore.log.error( `Invalid service URL: ${this.data.service}. Resetting session.`, + e.toString(), ) - console.error(e) this.clear() return false } @@ -160,7 +160,10 @@ export class SessionModel { this.rootStore.me.clear() } this.rootStore.me.load().catch(e => { - console.error('Failed to fetch local user information', e) + this.rootStore.log.error( + 'Failed to fetch local user information', + e.toString(), + ) }) return // success } @@ -204,7 +207,10 @@ export class SessionModel { this.configureApi() this.setOnline(true, false) this.rootStore.me.load().catch(e => { - console.error('Failed to fetch local user information', e) + this.rootStore.log.error( + 'Failed to fetch local user information', + e.toString(), + ) }) } } @@ -240,7 +246,10 @@ export class SessionModel { this.rootStore.onboard.start() this.configureApi() this.rootStore.me.load().catch(e => { - console.error('Failed to fetch local user information', e) + this.rootStore.log.error( + 'Failed to fetch local user information', + e.toString(), + ) }) } } @@ -248,7 +257,10 @@ export class SessionModel { async logout() { if (this.hasSession) { this.rootStore.api.com.atproto.session.delete().catch((e: any) => { - console.error('(Minor issue) Failed to delete session on the server', e) + this.rootStore.log.warn( + '(Minor issue) Failed to delete session on the server', + e, + ) }) } this.rootStore.clearAll() |