From 7e29ebbadbf6246a664a2bf45b3798b3ecd87955 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Sat, 4 Nov 2023 12:58:50 -0500 Subject: [PATCH] Fix other error logs while I'm at it --- src/lib/hooks/useFollowProfile.ts | 4 ++-- src/state/index.ts | 2 +- src/state/models/content/post-thread.ts | 2 +- src/state/models/content/profile.ts | 2 +- src/state/models/discovery/feeds.ts | 2 +- src/state/models/discovery/suggested-actors.ts | 2 +- src/state/models/feeds/notifications.ts | 17 ++++++++++------- src/state/models/feeds/post.ts | 2 +- src/state/models/feeds/posts.ts | 9 ++++----- src/state/models/lists/actor-feeds.ts | 2 +- src/state/models/lists/blocked-accounts.ts | 2 +- src/state/models/lists/likes.ts | 2 +- src/state/models/lists/lists-list.ts | 6 ++++-- src/state/models/lists/muted-accounts.ts | 2 +- src/state/models/lists/reposted-by.ts | 2 +- src/state/models/lists/user-followers.ts | 2 +- src/state/models/root-store.ts | 4 ++-- src/state/models/ui/create-account.ts | 4 ++-- src/state/models/ui/profile.ts | 12 +++++++++--- src/state/models/ui/saved-feeds.ts | 2 +- src/view/com/auth/login/Login.tsx | 8 ++++---- src/view/com/composer/photos/OpenCameraBtn.tsx | 2 +- src/view/com/composer/useExternalLinkFetch.ts | 8 +++++--- src/view/com/feeds/FeedSourceCard.tsx | 4 ++-- src/view/com/modals/AddAppPasswords.tsx | 2 +- src/view/com/modals/ChangeHandle.tsx | 6 +++--- .../com/modals/ContentFilteringSettings.tsx | 4 ++-- src/view/com/modals/UserAddRemoveLists.tsx | 4 ++-- src/view/com/post-thread/PostLikedBy.tsx | 8 ++++++-- src/view/com/post-thread/PostRepostedBy.tsx | 4 ++-- src/view/com/posts/FeedErrorMessage.tsx | 2 +- src/view/com/profile/ProfileFollowers.tsx | 14 ++++++++------ src/view/com/profile/ProfileHeader.tsx | 10 +++++----- src/view/screens/ModerationBlockedAccounts.tsx | 2 +- src/view/screens/ModerationMutedAccounts.tsx | 2 +- src/view/screens/Profile.tsx | 12 ++++++------ src/view/screens/ProfileFeed.tsx | 6 +++--- src/view/screens/ProfileList.tsx | 2 +- src/view/screens/SavedFeeds.tsx | 6 +++--- src/view/screens/Settings.tsx | 2 +- 40 files changed, 104 insertions(+), 86 deletions(-) diff --git a/src/lib/hooks/useFollowProfile.ts b/src/lib/hooks/useFollowProfile.ts index 6220daba..ca3f7ab8 100644 --- a/src/lib/hooks/useFollowProfile.ts +++ b/src/lib/hooks/useFollowProfile.ts @@ -22,7 +22,7 @@ export function useFollowProfile(profile: AppBskyActorDefs.ProfileViewBasic) { following: false, } } catch (e: any) { - store.log.error('Failed to delete follow', e) + store.log.error('Failed to delete follow', {error: e}) throw e } } else if (state === FollowState.NotFollowing) { @@ -40,7 +40,7 @@ export function useFollowProfile(profile: AppBskyActorDefs.ProfileViewBasic) { following: true, } } catch (e: any) { - store.log.error('Failed to create follow', e) + store.log.error('Failed to create follow', {error: e}) throw e } } diff --git a/src/state/index.ts b/src/state/index.ts index 42687a22..2c81c0dd 100644 --- a/src/state/index.ts +++ b/src/state/index.ts @@ -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() diff --git a/src/state/models/content/post-thread.ts b/src/state/models/content/post-thread.ts index a862c27d..cf6377da 100644 --- a/src/state/models/content/post-thread.ts +++ b/src/state/models/content/post-thread.ts @@ -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 } diff --git a/src/state/models/content/profile.ts b/src/state/models/content/profile.ts index 5333e711..0050970e 100644 --- a/src/state/models/content/profile.ts +++ b/src/state/models/content/profile.ts @@ -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}) } } diff --git a/src/state/models/discovery/feeds.ts b/src/state/models/discovery/feeds.ts index 1a00f802..3902f3ac 100644 --- a/src/state/models/discovery/feeds.ts +++ b/src/state/models/discovery/feeds.ts @@ -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}) } } diff --git a/src/state/models/discovery/suggested-actors.ts b/src/state/models/discovery/suggested-actors.ts index d270267e..8776fcd8 100644 --- a/src/state/models/discovery/suggested-actors.ts +++ b/src/state/models/discovery/suggested-actors.ts @@ -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}) } } } diff --git a/src/state/models/feeds/notifications.ts b/src/state/models/feeds/notifications.ts index 3f18c18d..a834b543 100644 --- a/src/state/models/feeds/notifications.ts +++ b/src/state/models/feeds/notifications.ts @@ -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, + }) } } diff --git a/src/state/models/feeds/post.ts b/src/state/models/feeds/post.ts index 3def5dce..be341710 100644 --- a/src/state/models/feeds/post.ts +++ b/src/state/models/feeds/post.ts @@ -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 diff --git a/src/state/models/feeds/posts.ts b/src/state/models/feeds/posts.ts index 3c580aca..5c10ae4c 100644 --- a/src/state/models/feeds/posts.ts +++ b/src/state/models/feeds/posts.ts @@ -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, + }) } } diff --git a/src/state/models/lists/actor-feeds.ts b/src/state/models/lists/actor-feeds.ts index d2bd7680..65da765f 100644 --- a/src/state/models/lists/actor-feeds.ts +++ b/src/state/models/lists/actor-feeds.ts @@ -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}) } } diff --git a/src/state/models/lists/blocked-accounts.ts b/src/state/models/lists/blocked-accounts.ts index 20eef8af..b4495b54 100644 --- a/src/state/models/lists/blocked-accounts.ts +++ b/src/state/models/lists/blocked-accounts.ts @@ -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}) } } diff --git a/src/state/models/lists/likes.ts b/src/state/models/lists/likes.ts index dd3cf18a..61e480e1 100644 --- a/src/state/models/lists/likes.ts +++ b/src/state/models/lists/likes.ts @@ -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}) } } diff --git a/src/state/models/lists/lists-list.ts b/src/state/models/lists/lists-list.ts index 42638757..7415d06d 100644 --- a/src/state/models/lists/lists-list.ts +++ b/src/state/models/lists/lists-list.ts @@ -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, + }) } } diff --git a/src/state/models/lists/muted-accounts.ts b/src/state/models/lists/muted-accounts.ts index 9c3e1157..bc9e53e5 100644 --- a/src/state/models/lists/muted-accounts.ts +++ b/src/state/models/lists/muted-accounts.ts @@ -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}) } } diff --git a/src/state/models/lists/reposted-by.ts b/src/state/models/lists/reposted-by.ts index 5d4fc107..fe639fd0 100644 --- a/src/state/models/lists/reposted-by.ts +++ b/src/state/models/lists/reposted-by.ts @@ -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}) } } diff --git a/src/state/models/lists/user-followers.ts b/src/state/models/lists/user-followers.ts index 1f817c33..d76ecce1 100644 --- a/src/state/models/lists/user-followers.ts +++ b/src/state/models/lists/user-followers.ts @@ -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}) } } diff --git a/src/state/models/root-store.ts b/src/state/models/root-store.ts index c9b460ba..621c87c1 100644 --- a/src/state/models/root-store.ts +++ b/src/state/models/root-store.ts @@ -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}) } } diff --git a/src/state/models/ui/create-account.ts b/src/state/models/ui/create-account.ts index 9f11a9b3..3bd39ba7 100644 --- a/src/state/models/ui/create-account.ts +++ b/src/state/models/ui/create-account.ts @@ -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 diff --git a/src/state/models/ui/profile.ts b/src/state/models/ui/profile.ts index 8525426b..47a99a8f 100644 --- a/src/state/models/ui/profile.ts +++ b/src/state/models/ui/profile.ts @@ -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() { diff --git a/src/state/models/ui/saved-feeds.ts b/src/state/models/ui/saved-feeds.ts index 667bc03a..72055abe 100644 --- a/src/state/models/ui/saved-feeds.ts +++ b/src/state/models/ui/saved-feeds.ts @@ -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}) } } diff --git a/src/view/com/auth/login/Login.tsx b/src/view/com/auth/login/Login.tsx index 8ec4cc81..348580fa 100644 --- a/src/view/com/auth/login/Login.tsx +++ b/src/view/com/auth/login/Login.tsx @@ -83,7 +83,7 @@ export const Login = ({onPressBack}: {onPressBack: () => void}) => { } store.log.warn( `Failed to fetch service description for ${serviceUrl}`, - err, + {error: err}, ) setError( 'Unable to contact your service. Please check your Internet connection.', @@ -349,7 +349,7 @@ const LoginForm = ({ }) } catch (e: any) { const errMsg = e.toString() - store.log.warn('Failed to login', e) + store.log.warn('Failed to login', {error: e}) setIsProcessing(false) if (errMsg.includes('Authentication Required')) { setError('Invalid username or password') @@ -578,7 +578,7 @@ const ForgotPasswordForm = ({ onEmailSent() } catch (e: any) { const errMsg = e.toString() - store.log.warn('Failed to request password reset', e) + store.log.warn('Failed to request password reset', {error: e}) setIsProcessing(false) if (isNetworkError(e)) { setError( @@ -734,7 +734,7 @@ const SetNewPasswordForm = ({ onPasswordSet() } catch (e: any) { const errMsg = e.toString() - store.log.warn('Failed to set new password', e) + store.log.warn('Failed to set new password', {error: e}) setIsProcessing(false) if (isNetworkError(e)) { setError( diff --git a/src/view/com/composer/photos/OpenCameraBtn.tsx b/src/view/com/composer/photos/OpenCameraBtn.tsx index a6917b36..bd4d4b65 100644 --- a/src/view/com/composer/photos/OpenCameraBtn.tsx +++ b/src/view/com/composer/photos/OpenCameraBtn.tsx @@ -39,7 +39,7 @@ export function OpenCameraBtn({gallery}: Props) { gallery.add(img) } catch (err: any) { // ignore - store.log.warn('Error using camera', err) + store.log.warn('Error using camera', {error: err}) } }, [gallery, track, store, requestCameraAccessIfNeeded]) diff --git a/src/view/com/composer/useExternalLinkFetch.ts b/src/view/com/composer/useExternalLinkFetch.ts index 6592ed57..aa5b4b43 100644 --- a/src/view/com/composer/useExternalLinkFetch.ts +++ b/src/view/com/composer/useExternalLinkFetch.ts @@ -46,7 +46,9 @@ export function useExternalLinkFetch({ setExtLink(undefined) }, err => { - store.log.error('Failed to fetch post for quote embedding', {err}) + store.log.error('Failed to fetch post for quote embedding', { + error: err, + }) setExtLink(undefined) }, ) @@ -64,7 +66,7 @@ export function useExternalLinkFetch({ }) }, err => { - store.log.error('Failed to fetch feed for embedding', {err}) + store.log.error('Failed to fetch feed for embedding', {error: err}) setExtLink(undefined) }, ) @@ -82,7 +84,7 @@ export function useExternalLinkFetch({ }) }, err => { - store.log.error('Failed to fetch list for embedding', {err}) + store.log.error('Failed to fetch list for embedding', {error: err}) setExtLink(undefined) }, ) diff --git a/src/view/com/feeds/FeedSourceCard.tsx b/src/view/com/feeds/FeedSourceCard.tsx index 6b5a572b..060a4b63 100644 --- a/src/view/com/feeds/FeedSourceCard.tsx +++ b/src/view/com/feeds/FeedSourceCard.tsx @@ -45,7 +45,7 @@ export const FeedSourceCard = observer(function FeedSourceCardImpl({ Toast.show('Removed from my feeds') } catch (e) { Toast.show('There was an issue contacting your server') - store.log.error('Failed to unsave feed', {e}) + store.log.error('Failed to unsave feed', {error: e}) } }, }) @@ -55,7 +55,7 @@ export const FeedSourceCard = observer(function FeedSourceCardImpl({ Toast.show('Added to my feeds') } catch (e) { Toast.show('There was an issue contacting your server') - store.log.error('Failed to save feed', {e}) + store.log.error('Failed to save feed', {error: e}) } } }, [store, item]) diff --git a/src/view/com/modals/AddAppPasswords.tsx b/src/view/com/modals/AddAppPasswords.tsx index 2a867213..71199e34 100644 --- a/src/view/com/modals/AddAppPasswords.tsx +++ b/src/view/com/modals/AddAppPasswords.tsx @@ -95,7 +95,7 @@ export function Component({}: {}) { } } catch (e) { Toast.show('Failed to create app password.') - store.log.error('Failed to create app password', {e}) + store.log.error('Failed to create app password', {error: e}) } } diff --git a/src/view/com/modals/ChangeHandle.tsx b/src/view/com/modals/ChangeHandle.tsx index a1226680..2fb1a503 100644 --- a/src/view/com/modals/ChangeHandle.tsx +++ b/src/view/com/modals/ChangeHandle.tsx @@ -69,7 +69,7 @@ export function Component({onChanged}: {onChanged: () => void}) { `Failed to fetch service description for ${String( store.agent.service, )}`, - err, + {error: err}, ) setError( 'Unable to contact your service. Please check your Internet connection.', @@ -113,7 +113,7 @@ export function Component({onChanged}: {onChanged: () => void}) { onChanged() } catch (err: any) { setError(cleanError(err)) - store.log.error('Failed to update handle', {handle, err}) + store.log.error('Failed to update handle', {handle, error: err}) } finally { setProcessing(false) } @@ -343,7 +343,7 @@ function CustomHandleForm({ } } catch (err: any) { setError(cleanError(err)) - store.log.error('Failed to verify domain', {handle, err}) + store.log.error('Failed to verify domain', {handle, error: err}) } finally { setIsVerifying(false) } diff --git a/src/view/com/modals/ContentFilteringSettings.tsx b/src/view/com/modals/ContentFilteringSettings.tsx index aa0674d7..b78846bd 100644 --- a/src/view/com/modals/ContentFilteringSettings.tsx +++ b/src/view/com/modals/ContentFilteringSettings.tsx @@ -103,7 +103,7 @@ const AdultContentEnabledPref = observer( Toast.show( 'There was an issue syncing your preferences with the server', ) - store.log.error('Failed to update preferences with server', {e}) + store.log.error('Failed to update preferences with server', {error: e}) } } @@ -168,7 +168,7 @@ const ContentLabelPref = observer(function ContentLabelPrefImpl({ Toast.show( 'There was an issue syncing your preferences with the server', ) - store.log.error('Failed to update preferences with server', {e}) + store.log.error('Failed to update preferences with server', {error: e}) } }, [store, group], diff --git a/src/view/com/modals/UserAddRemoveLists.tsx b/src/view/com/modals/UserAddRemoveLists.tsx index ff048ca2..32da6403 100644 --- a/src/view/com/modals/UserAddRemoveLists.tsx +++ b/src/view/com/modals/UserAddRemoveLists.tsx @@ -62,7 +62,7 @@ export const Component = observer(function UserAddRemoveListsImpl({ setMembershipsLoaded(true) }, err => { - store.log.error('Failed to fetch memberships', {err}) + store.log.error('Failed to fetch memberships', {error: err}) }, ) }, [memberships, listsList, store, setSelected, setMembershipsLoaded]) @@ -76,7 +76,7 @@ export const Component = observer(function UserAddRemoveListsImpl({ try { changes = await memberships.updateTo(selected) } catch (err) { - store.log.error('Failed to update memberships', {err}) + store.log.error('Failed to update memberships', {error: err}) return } Toast.show('Lists updated') diff --git a/src/view/com/post-thread/PostLikedBy.tsx b/src/view/com/post-thread/PostLikedBy.tsx index 574fe1e8..d16e8d30 100644 --- a/src/view/com/post-thread/PostLikedBy.tsx +++ b/src/view/com/post-thread/PostLikedBy.tsx @@ -18,7 +18,9 @@ export const PostLikedBy = observer(function PostLikedByImpl({ const view = React.useMemo(() => new LikesModel(store, {uri}), [store, uri]) useEffect(() => { - view.loadMore().catch(err => store.log.error('Failed to fetch likes', err)) + view + .loadMore() + .catch(err => store.log.error('Failed to fetch likes', {error: err})) }, [view, store.log]) const onRefresh = () => { @@ -27,7 +29,9 @@ export const PostLikedBy = observer(function PostLikedByImpl({ const onEndReached = () => { view .loadMore() - .catch(err => view?.rootStore.log.error('Failed to load more likes', err)) + .catch(err => + view?.rootStore.log.error('Failed to load more likes', {error: err}), + ) } if (!view.hasLoaded) { diff --git a/src/view/com/post-thread/PostRepostedBy.tsx b/src/view/com/post-thread/PostRepostedBy.tsx index e4b59277..0e681777 100644 --- a/src/view/com/post-thread/PostRepostedBy.tsx +++ b/src/view/com/post-thread/PostRepostedBy.tsx @@ -23,7 +23,7 @@ export const PostRepostedBy = observer(function PostRepostedByImpl({ useEffect(() => { view .loadMore() - .catch(err => store.log.error('Failed to fetch reposts', err)) + .catch(err => store.log.error('Failed to fetch reposts', {error: err})) }, [view, store.log]) const onRefresh = () => { @@ -33,7 +33,7 @@ export const PostRepostedBy = observer(function PostRepostedByImpl({ view .loadMore() .catch(err => - view?.rootStore.log.error('Failed to load more reposts', err), + view?.rootStore.log.error('Failed to load more reposts', {error: err}), ) } diff --git a/src/view/com/posts/FeedErrorMessage.tsx b/src/view/com/posts/FeedErrorMessage.tsx index 51c735e3..52fa9246 100644 --- a/src/view/com/posts/FeedErrorMessage.tsx +++ b/src/view/com/posts/FeedErrorMessage.tsx @@ -73,7 +73,7 @@ function FeedgenErrorMessage({ Toast.show( 'There was an an issue removing this feed. Please check your internet connection and try again.', ) - store.log.error('Failed to remove feed', {err}) + store.log.error('Failed to remove feed', {error: err}) } }, onPressCancel() { diff --git a/src/view/com/profile/ProfileFollowers.tsx b/src/view/com/profile/ProfileFollowers.tsx index beb9609b..7e41b131 100644 --- a/src/view/com/profile/ProfileFollowers.tsx +++ b/src/view/com/profile/ProfileFollowers.tsx @@ -26,18 +26,20 @@ export const ProfileFollowers = observer(function ProfileFollowers({ useEffect(() => { view .loadMore() - .catch(err => store.log.error('Failed to fetch user followers', err)) + .catch(err => + store.log.error('Failed to fetch user followers', {error: err}), + ) }, [view, store.log]) const onRefresh = () => { view.refresh() } const onEndReached = () => { - view - .loadMore() - .catch(err => - view?.rootStore.log.error('Failed to load more followers', err), - ) + view.loadMore().catch(err => + view?.rootStore.log.error('Failed to load more followers', { + error: err, + }), + ) } if (!view.hasLoaded) { diff --git a/src/view/com/profile/ProfileHeader.tsx b/src/view/com/profile/ProfileHeader.tsx index 082fbc0b..d4fd88ca 100644 --- a/src/view/com/profile/ProfileHeader.tsx +++ b/src/view/com/profile/ProfileHeader.tsx @@ -150,7 +150,7 @@ const ProfileHeaderLoaded = observer(function ProfileHeaderLoadedImpl({ : 'ProfileHeader:UnfollowButtonClicked', ) }, - err => store.log.error('Failed to toggle follow', err), + err => store.log.error('Failed to toggle follow', {error: err}), ) }, [track, view, store.log, setShowSuggestedFollows]) @@ -193,7 +193,7 @@ const ProfileHeaderLoaded = observer(function ProfileHeaderLoadedImpl({ await view.muteAccount() Toast.show('Account muted') } catch (e: any) { - store.log.error('Failed to mute account', e) + store.log.error('Failed to mute account', {error: e}) Toast.show(`There was an issue! ${e.toString()}`) } }, [track, view, store]) @@ -204,7 +204,7 @@ const ProfileHeaderLoaded = observer(function ProfileHeaderLoadedImpl({ await view.unmuteAccount() Toast.show('Account unmuted') } catch (e: any) { - store.log.error('Failed to unmute account', e) + store.log.error('Failed to unmute account', {error: e}) Toast.show(`There was an issue! ${e.toString()}`) } }, [track, view, store]) @@ -222,7 +222,7 @@ const ProfileHeaderLoaded = observer(function ProfileHeaderLoadedImpl({ onRefreshAll() Toast.show('Account blocked') } catch (e: any) { - store.log.error('Failed to block account', e) + store.log.error('Failed to block account', {error: e}) Toast.show(`There was an issue! ${e.toString()}`) } }, @@ -242,7 +242,7 @@ const ProfileHeaderLoaded = observer(function ProfileHeaderLoadedImpl({ onRefreshAll() Toast.show('Account unblocked') } catch (e: any) { - store.log.error('Failed to unblock account', e) + store.log.error('Failed to unblock account', {error: e}) Toast.show(`There was an issue! ${e.toString()}`) } }, diff --git a/src/view/screens/ModerationBlockedAccounts.tsx b/src/view/screens/ModerationBlockedAccounts.tsx index 7bbb6bee..a32c5e36 100644 --- a/src/view/screens/ModerationBlockedAccounts.tsx +++ b/src/view/screens/ModerationBlockedAccounts.tsx @@ -52,7 +52,7 @@ export const ModerationBlockedAccounts = withAuthRequired( blockedAccounts .loadMore() .catch(err => - store.log.error('Failed to load more blocked accounts', err), + store.log.error('Failed to load more blocked accounts', {error: err}), ) }, [blockedAccounts, store]) diff --git a/src/view/screens/ModerationMutedAccounts.tsx b/src/view/screens/ModerationMutedAccounts.tsx index 31c46e64..61911717 100644 --- a/src/view/screens/ModerationMutedAccounts.tsx +++ b/src/view/screens/ModerationMutedAccounts.tsx @@ -49,7 +49,7 @@ export const ModerationMutedAccounts = withAuthRequired( mutedAccounts .loadMore() .catch(err => - store.log.error('Failed to load more muted accounts', err), + store.log.error('Failed to load more muted accounts', {error: err}), ) }, [mutedAccounts, store]) diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx index 6c5a84e8..d353c411 100644 --- a/src/view/screens/Profile.tsx +++ b/src/view/screens/Profile.tsx @@ -108,15 +108,15 @@ export const ProfileScreen = withAuthRequired( uiState .refresh() .catch((err: any) => - store.log.error('Failed to refresh user profile', err), + store.log.error('Failed to refresh user profile', {error: err}), ) }, [uiState, store]) const onEndReached = React.useCallback(() => { - uiState - .loadMore() - .catch((err: any) => - store.log.error('Failed to load more entries in user profile', err), - ) + uiState.loadMore().catch((err: any) => + store.log.error('Failed to load more entries in user profile', { + error: err, + }), + ) }, [uiState, store]) const onPressTryAgain = React.useCallback(() => { uiState.setup() diff --git a/src/view/screens/ProfileFeed.tsx b/src/view/screens/ProfileFeed.tsx index 70e52bf7..a76f2eb6 100644 --- a/src/view/screens/ProfileFeed.tsx +++ b/src/view/screens/ProfileFeed.tsx @@ -165,7 +165,7 @@ export const ProfileFeedScreenInner = observer( Toast.show( 'There was an an issue updating your feeds, please check your internet connection and try again.', ) - store.log.error('Failed up update feeds', {err}) + store.log.error('Failed up update feeds', {error: err}) } }, [store, feedInfo]) @@ -181,7 +181,7 @@ export const ProfileFeedScreenInner = observer( Toast.show( 'There was an an issue contacting the server, please check your internet connection and try again.', ) - store.log.error('Failed up toggle like', {err}) + store.log.error('Failed up toggle like', {error: err}) } }, [store, feedInfo]) @@ -190,7 +190,7 @@ export const ProfileFeedScreenInner = observer( if (feedInfo) { feedInfo.togglePin().catch(e => { Toast.show('There was an issue contacting the server') - store.log.error('Failed to toggle pinned feed', {e}) + store.log.error('Failed to toggle pinned feed', {error: e}) }) } }, [store, feedInfo]) diff --git a/src/view/screens/ProfileList.tsx b/src/view/screens/ProfileList.tsx index 4fc4b6c7..1aa2a21b 100644 --- a/src/view/screens/ProfileList.tsx +++ b/src/view/screens/ProfileList.tsx @@ -272,7 +272,7 @@ const Header = observer(function HeaderImpl({ Haptics.default() list.togglePin().catch(e => { Toast.show('There was an issue contacting the server') - store.log.error('Failed to toggle pinned list', {e}) + store.log.error('Failed to toggle pinned list', {error: e}) }) }, [store, list]) diff --git a/src/view/screens/SavedFeeds.tsx b/src/view/screens/SavedFeeds.tsx index 0f627828..900bb06a 100644 --- a/src/view/screens/SavedFeeds.tsx +++ b/src/view/screens/SavedFeeds.tsx @@ -166,14 +166,14 @@ const ListItem = observer(function ListItemImpl({ Haptics.default() item.togglePin().catch(e => { Toast.show('There was an issue contacting the server') - store.log.error('Failed to toggle pinned feed', {e}) + store.log.error('Failed to toggle pinned feed', {error: e}) }) }, [item, store]) const onPressUp = useCallback( () => savedFeeds.movePinnedFeed(item, 'up').catch(e => { Toast.show('There was an issue contacting the server') - store.log.error('Failed to set pinned feed order', {e}) + store.log.error('Failed to set pinned feed order', {error: e}) }), [store, savedFeeds, item], ) @@ -181,7 +181,7 @@ const ListItem = observer(function ListItemImpl({ () => savedFeeds.movePinnedFeed(item, 'down').catch(e => { Toast.show('There was an issue contacting the server') - store.log.error('Failed to set pinned feed order', {e}) + store.log.error('Failed to set pinned feed order', {error: e}) }), [store, savedFeeds, item], ) diff --git a/src/view/screens/Settings.tsx b/src/view/screens/Settings.tsx index 2112ec7d..c2c6d1ef 100644 --- a/src/view/screens/Settings.tsx +++ b/src/view/screens/Settings.tsx @@ -112,7 +112,7 @@ export const SettingsScreen = withAuthRequired( err => { store.log.error( 'Failed to reload from server after handle update', - {err}, + {error: err}, ) setIsSwitching(false) },