Fix immediate TS errors

This commit is contained in:
Eric Bailey
2023-11-04 12:42:27 -05:00
parent 5fd41ad5a2
commit df0dcf32f9
19 changed files with 81 additions and 71 deletions
+5 -5
View File
@@ -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')
}
+5 -3
View File
@@ -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,
})
}
}
+1 -1
View File
@@ -220,7 +220,7 @@ export class NotificationsFeedItemModel {
}
this.rootStore.log.warn(
'app.bsky.notifications.list served an unsupported record type',
v,
{record: v},
)
}
+7 -8
View File
@@ -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')
}
+3 -4
View File
@@ -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,
})
}
}
}
+15 -7
View File
@@ -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})
}
}
}
+1 -1
View File
@@ -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})
}
}