Fix other error logs while I'm at it

This commit is contained in:
Eric Bailey 2023-11-04 12:58:50 -05:00
parent df0dcf32f9
commit 7e29ebbadb
40 changed files with 104 additions and 86 deletions

View file

@ -25,7 +25,7 @@ export async function setupState(serviceUri = DEFAULT_SERVICE) {
rootStore.log.debug('Initial hydrate', {hasSession: !!data.session})
rootStore.hydrate(data)
} catch (e: any) {
rootStore.log.error('Failed to load state from storage', e)
rootStore.log.error('Failed to load state from storage', {error: e})
}
rootStore.attemptSessionResumption()

View file

@ -163,7 +163,7 @@ export class PostThreadModel {
this.hasLoaded = true
this.error = cleanError(err)
if (err) {
this.rootStore.log.error('Failed to fetch post thread', err)
this.rootStore.log.error('Failed to fetch post thread', {error: err})
}
this.notFound = err instanceof GetPostThread.NotFoundError
}

View file

@ -235,7 +235,7 @@ export class ProfileModel {
this.hasLoaded = true
this.error = cleanError(err)
if (err) {
this.rootStore.log.error('Failed to fetch profile', err)
this.rootStore.log.error('Failed to fetch profile', {error: err})
}
}

View file

@ -120,7 +120,7 @@ export class FeedsDiscoveryModel {
this.hasLoaded = true
this.error = cleanError(err)
if (err) {
this.rootStore.log.error('Failed to fetch popular feeds', err)
this.rootStore.log.error('Failed to fetch popular feeds', {error: err})
}
}

View file

@ -144,7 +144,7 @@ export class SuggestedActorsModel {
this.hasLoaded = true
this.error = cleanError(err)
if (err) {
this.rootStore.log.error('Failed to fetch suggested actors', err)
this.rootStore.log.error('Failed to fetch suggested actors', {error: err})
}
}
}

View file

@ -401,7 +401,9 @@ export class NotificationsFeedModel {
this._setQueued(this._filterNotifications(queueModels))
this._countUnread()
} catch (e) {
this.rootStore.log.error('NotificationsModel:syncQueue failed', {e})
this.rootStore.log.error('NotificationsModel:syncQueue failed', {
error: e,
})
} finally {
this.lock.release()
}
@ -481,7 +483,9 @@ export class NotificationsFeedModel {
this.lastSync ? this.lastSync.toISOString() : undefined,
)
} catch (e: any) {
this.rootStore.log.warn('Failed to update notifications read state', e)
this.rootStore.log.warn('Failed to update notifications read state', {
error: e,
})
}
}
@ -501,13 +505,12 @@ export class NotificationsFeedModel {
this.error = cleanError(error)
this.loadMoreError = cleanError(loadMoreError)
if (error) {
this.rootStore.log.error('Failed to fetch notifications', error)
this.rootStore.log.error('Failed to fetch notifications', {error})
}
if (loadMoreError) {
this.rootStore.log.error(
'Failed to load more notifications',
loadMoreError,
)
this.rootStore.log.error('Failed to load more notifications', {
error: loadMoreError,
})
}
}

View file

@ -51,7 +51,7 @@ export class PostsFeedItemModel {
this.richText = undefined
rootStore.log.warn(
'app.bsky.feed.getTimeline or app.bsky.feed.getAuthorFeed served an unexpected record type',
this.post.record,
{record: this.post.record},
)
}
this.reply = v.reply

View file

@ -324,13 +324,12 @@ export class PostsFeedModel {
this.knownError = detectKnownError(this.feedType, error)
this.loadMoreError = cleanError(loadMoreError)
if (error) {
this.rootStore.log.error('Posts feed request failed', error)
this.rootStore.log.error('Posts feed request failed', {error})
}
if (loadMoreError) {
this.rootStore.log.error(
'Posts feed load-more request failed',
loadMoreError,
)
this.rootStore.log.error('Posts feed load-more request failed', {
error: loadMoreError,
})
}
}

View file

@ -98,7 +98,7 @@ export class ActorFeedsModel {
this.hasLoaded = true
this.error = cleanError(err)
if (err) {
this.rootStore.log.error('Failed to fetch user followers', err)
this.rootStore.log.error('Failed to fetch user followers', {error: err})
}
}

View file

@ -86,7 +86,7 @@ export class BlockedAccountsModel {
this.hasLoaded = true
this.error = cleanError(err)
if (err) {
this.rootStore.log.error('Failed to fetch user followers', err)
this.rootStore.log.error('Failed to fetch user followers', {error: err})
}
}

View file

@ -97,7 +97,7 @@ export class LikesModel {
this.hasLoaded = true
this.error = cleanError(err)
if (err) {
this.rootStore.log.error('Failed to fetch likes', err)
this.rootStore.log.error('Failed to fetch likes', {error: err})
}
}

View file

@ -204,10 +204,12 @@ export class ListsListModel {
this.error = cleanError(err)
this.loadMoreError = cleanError(loadMoreErr)
if (err) {
this.rootStore.log.error('Failed to fetch user lists', err)
this.rootStore.log.error('Failed to fetch user lists', {error: err})
}
if (loadMoreErr) {
this.rootStore.log.error('Failed to fetch user lists', loadMoreErr)
this.rootStore.log.error('Failed to fetch user lists', {
error: loadMoreErr,
})
}
}

View file

@ -86,7 +86,7 @@ export class MutedAccountsModel {
this.hasLoaded = true
this.error = cleanError(err)
if (err) {
this.rootStore.log.error('Failed to fetch user followers', err)
this.rootStore.log.error('Failed to fetch user followers', {error: err})
}
}

View file

@ -100,7 +100,7 @@ export class RepostedByModel {
this.hasLoaded = true
this.error = cleanError(err)
if (err) {
this.rootStore.log.error('Failed to fetch reposted by view', err)
this.rootStore.log.error('Failed to fetch reposted by view', {error: err})
}
}

View file

@ -99,7 +99,7 @@ export class UserFollowersModel {
this.hasLoaded = true
this.error = cleanError(err)
if (err) {
this.rootStore.log.error('Failed to fetch user followers', err)
this.rootStore.log.error('Failed to fetch user followers', {error: err})
}
}

View file

@ -130,7 +130,7 @@ export class RootStoreModel {
})
this.updateSessionState()
} catch (e: any) {
this.log.warn('Failed to initialize session', e)
this.log.warn('Failed to initialize session', {error: e})
}
}
@ -184,7 +184,7 @@ export class RootStoreModel {
await this.me.updateIfNeeded()
await this.preferences.sync()
} catch (e: any) {
this.log.error('Failed to fetch latest state', e)
this.log.error('Failed to fetch latest state', {error: e})
}
}

View file

@ -78,7 +78,7 @@ export class CreateAccountModel {
} catch (err: any) {
this.rootStore.log.warn(
`Failed to fetch service description for ${this.serviceUrl}`,
err,
{error: err},
)
this.setError(
'Unable to contact your service. Please check your Internet connection.',
@ -127,7 +127,7 @@ export class CreateAccountModel {
errMsg =
'Invite code not accepted. Check that you input it correctly and try again.'
}
this.rootStore.log.error('Failed to create account', e)
this.rootStore.log.error('Failed to create account', {error: e})
this.setIsProcessing(false)
this.setError(cleanError(errMsg))
throw e

View file

@ -223,10 +223,14 @@ export class ProfileUiModel {
await Promise.all([
this.profile
.setup()
.catch(err => this.rootStore.log.error('Failed to fetch profile', err)),
.catch(err =>
this.rootStore.log.error('Failed to fetch profile', {error: err}),
),
this.feed
.setup()
.catch(err => this.rootStore.log.error('Failed to fetch feed', err)),
.catch(err =>
this.rootStore.log.error('Failed to fetch feed', {error: err}),
),
])
runInAction(() => {
this.isAuthenticatedUser =
@ -237,7 +241,9 @@ export class ProfileUiModel {
this.lists.source = this.profile.did
this.lists
.loadMore()
.catch(err => this.rootStore.log.error('Failed to fetch lists', err))
.catch(err =>
this.rootStore.log.error('Failed to fetch lists', {error: err}),
)
}
async refresh() {

View file

@ -126,7 +126,7 @@ export class SavedFeedsModel {
this.hasLoaded = true
this.error = cleanError(err)
if (err) {
this.rootStore.log.error('Failed to fetch user feeds', err)
this.rootStore.log.error('Failed to fetch user feeds', {err})
}
}