diff options
Diffstat (limited to 'src/state/models')
-rw-r--r-- | src/state/models/content/feed-source.ts | 10 | ||||
-rw-r--r-- | src/state/models/content/list.ts | 8 | ||||
-rw-r--r-- | src/state/models/feeds/notifications.ts | 2 | ||||
-rw-r--r-- | src/state/models/feeds/post.ts | 15 | ||||
-rw-r--r-- | src/state/models/invited-users.ts | 7 | ||||
-rw-r--r-- | src/state/models/me.ts | 22 | ||||
-rw-r--r-- | src/state/models/media/image.ts | 2 |
7 files changed, 37 insertions, 29 deletions
diff --git a/src/state/models/content/feed-source.ts b/src/state/models/content/feed-source.ts index 8dac9b56f..d1b8fc9dc 100644 --- a/src/state/models/content/feed-source.ts +++ b/src/state/models/content/feed-source.ts @@ -134,7 +134,7 @@ export class FeedSourceModel { try { await this.rootStore.preferences.addSavedFeed(this.uri) } catch (error) { - this.rootStore.log.error('Failed to save feed', error) + this.rootStore.log.error('Failed to save feed', {error}) } finally { track('CustomFeed:Save') } @@ -147,7 +147,7 @@ export class FeedSourceModel { try { await this.rootStore.preferences.removeSavedFeed(this.uri) } catch (error) { - this.rootStore.log.error('Failed to unsave feed', error) + this.rootStore.log.error('Failed to unsave feed', {error}) } finally { track('CustomFeed:Unsave') } @@ -157,7 +157,7 @@ export class FeedSourceModel { try { await this.rootStore.preferences.addPinnedFeed(this.uri) } catch (error) { - this.rootStore.log.error('Failed to pin feed', error) + this.rootStore.log.error('Failed to pin feed', {error}) } finally { track('CustomFeed:Pin', { name: this.displayName, @@ -194,7 +194,7 @@ export class FeedSourceModel { } catch (e: any) { this.likeUri = undefined this.likeCount = (this.likeCount || 1) - 1 - this.rootStore.log.error('Failed to like feed', e) + this.rootStore.log.error('Failed to like feed', {error: e}) } finally { track('CustomFeed:Like') } @@ -215,7 +215,7 @@ export class FeedSourceModel { } catch (e: any) { this.likeUri = uri this.likeCount = (this.likeCount || 0) + 1 - this.rootStore.log.error('Failed to unlike feed', e) + this.rootStore.log.error('Failed to unlike feed', {error: e}) } finally { track('CustomFeed:Unlike') } diff --git a/src/state/models/content/list.ts b/src/state/models/content/list.ts index 8fb9f4b5e..985d8d82d 100644 --- a/src/state/models/content/list.ts +++ b/src/state/models/content/list.ts @@ -339,7 +339,7 @@ export class ListModel { try { await this.rootStore.preferences.addPinnedFeed(this.uri) } catch (error) { - this.rootStore.log.error('Failed to pin feed', error) + this.rootStore.log.error('Failed to pin feed', {error}) } finally { track('CustomFeed:Pin', { name: this.data?.name || '', @@ -455,10 +455,12 @@ export class ListModel { this.error = cleanError(err) this.loadMoreError = cleanError(loadMoreErr) if (err) { - this.rootStore.log.error('Failed to fetch user items', err) + this.rootStore.log.error('Failed to fetch user items', {error: err}) } if (loadMoreErr) { - this.rootStore.log.error('Failed to fetch user items', loadMoreErr) + this.rootStore.log.error('Failed to fetch user items', { + error: loadMoreErr, + }) } } diff --git a/src/state/models/feeds/notifications.ts b/src/state/models/feeds/notifications.ts index 34f5d4add..3f18c18d7 100644 --- a/src/state/models/feeds/notifications.ts +++ b/src/state/models/feeds/notifications.ts @@ -220,7 +220,7 @@ export class NotificationsFeedItemModel { } this.rootStore.log.warn( 'app.bsky.notifications.list served an unsupported record type', - v, + {record: v}, ) } diff --git a/src/state/models/feeds/post.ts b/src/state/models/feeds/post.ts index d46cced75..3def5dce3 100644 --- a/src/state/models/feeds/post.ts +++ b/src/state/models/feeds/post.ts @@ -42,10 +42,9 @@ export class PostsFeedItemModel { } else { this.postRecord = undefined this.richText = undefined - rootStore.log.warn( - 'Received an invalid app.bsky.feed.post record', - valid.error, - ) + rootStore.log.warn('Received an invalid app.bsky.feed.post record', { + error: valid.error, + }) } } else { this.postRecord = undefined @@ -133,7 +132,7 @@ export class PostsFeedItemModel { track('Post:Like') } } catch (error) { - this.rootStore.log.error('Failed to toggle like', error) + this.rootStore.log.error('Failed to toggle like', {error}) } } @@ -168,7 +167,7 @@ export class PostsFeedItemModel { track('Post:Repost') } } catch (error) { - this.rootStore.log.error('Failed to toggle repost', error) + this.rootStore.log.error('Failed to toggle repost', {error}) } } @@ -182,7 +181,7 @@ export class PostsFeedItemModel { track('Post:ThreadMute') } } catch (error) { - this.rootStore.log.error('Failed to toggle thread mute', error) + this.rootStore.log.error('Failed to toggle thread mute', {error}) } } @@ -191,7 +190,7 @@ export class PostsFeedItemModel { await this.rootStore.agent.deletePost(this.post.uri) this.rootStore.emitPostDeleted(this.post.uri) } catch (error) { - this.rootStore.log.error('Failed to delete post', error) + this.rootStore.log.error('Failed to delete post', {error}) } finally { track('Post:Delete') } diff --git a/src/state/models/invited-users.ts b/src/state/models/invited-users.ts index cd3667062..995c4bfb5 100644 --- a/src/state/models/invited-users.ts +++ b/src/state/models/invited-users.ts @@ -63,10 +63,9 @@ export class InvitedUsers { }) this.rootStore.me.follows.hydrateMany(this.profiles) } catch (e) { - this.rootStore.log.error( - 'Failed to fetch profiles for invited users', - e, - ) + this.rootStore.log.error('Failed to fetch profiles for invited users', { + error: e, + }) } } } diff --git a/src/state/models/me.ts b/src/state/models/me.ts index e7baf5bf2..14b2ef843 100644 --- a/src/state/models/me.ts +++ b/src/state/models/me.ts @@ -110,13 +110,17 @@ export class MeModel { await this.fetchProfile() this.mainFeed.clear() /* dont await */ this.mainFeed.setup().catch(e => { - this.rootStore.log.error('Failed to setup main feed model', e) + this.rootStore.log.error('Failed to setup main feed model', {error: e}) }) /* dont await */ this.notifications.setup().catch(e => { - this.rootStore.log.error('Failed to setup notifications model', e) + this.rootStore.log.error('Failed to setup notifications model', { + error: e, + }) }) /* dont await */ this.notifications.setup().catch(e => { - this.rootStore.log.error('Failed to setup notifications model', e) + this.rootStore.log.error('Failed to setup notifications model', { + error: e, + }) }) this.myFeeds.clear() /* dont await */ this.myFeeds.saved.refresh() @@ -184,7 +188,9 @@ export class MeModel { }) }) } catch (e) { - this.rootStore.log.error('Failed to fetch user invite codes', e) + this.rootStore.log.error('Failed to fetch user invite codes', { + error: e, + }) } await this.rootStore.invitedUsers.fetch(this.invites) } @@ -199,7 +205,9 @@ export class MeModel { this.appPasswords = res.data.passwords }) } catch (e) { - this.rootStore.log.error('Failed to fetch user app passwords', e) + this.rootStore.log.error('Failed to fetch user app passwords', { + error: e, + }) } } } @@ -220,7 +228,7 @@ export class MeModel { }) return res.data } catch (e) { - this.rootStore.log.error('Failed to create app password', e) + this.rootStore.log.error('Failed to create app password', {error: e}) } } } @@ -235,7 +243,7 @@ export class MeModel { this.appPasswords = this.appPasswords.filter(p => p.name !== name) }) } catch (e) { - this.rootStore.log.error('Failed to delete app password', e) + this.rootStore.log.error('Failed to delete app password', {error: e}) } } } diff --git a/src/state/models/media/image.ts b/src/state/models/media/image.ts index c26f9b87c..4ca0b47c6 100644 --- a/src/state/models/media/image.ts +++ b/src/state/models/media/image.ts @@ -188,7 +188,7 @@ export class ImageModel implements Omit<RNImage, 'size'> { this.cropped = cropped }) } catch (err) { - this.rootStore.log.error('Failed to crop photo', err) + this.rootStore.log.error('Failed to crop photo', {error: err}) } } |