diff --git a/packages/web-client/src/components/hot-or-not/HotOrNotVote.svelte b/packages/web-client/src/components/hot-or-not/HotOrNotVote.svelte index 01809c41c..ed5d34cc6 100644 --- a/packages/web-client/src/components/hot-or-not/HotOrNotVote.svelte +++ b/packages/web-client/src/components/hot-or-not/HotOrNotVote.svelte @@ -72,7 +72,7 @@ async function getBetDetailFromDb() { try { idb = (await import('$lib/idb')).idb } catch (e) { - Log('error', 'Error while accessing IDB', { + Log('warn', 'Error while accessing IDB', { error: e, source: 'HotOrNotVote.getBetDetailFromDb', type: 'idb', @@ -86,7 +86,7 @@ async function getBetDetailFromDb() { post.publisher_canister_id + '@' + post.post_id, )) as PlacedBetDetail } catch (e) { - Log('error', 'Error while accessing IDB', { + Log('warn', 'Error while accessing IDB', { error: e, source: 'HotOrNotVote.saveBetToDb', type: 'idb', @@ -114,7 +114,7 @@ async function updatePlacedBetDetail() { } } catch (e) { //TODO: Add retries - Log('error', 'Could not fetch bet details', { + Log('warn', 'Could not fetch bet details', { error: e, source: 'HotOrNotVote.updatePlacedBetDetail', }) @@ -218,7 +218,7 @@ async function placeVote({ coins, direction }: PlaceVote) { loadingWithDirection = false } } catch (e) { - Log('error', 'Could not place bet', { + Log('warn', 'Could not place bet', { error: e, postId: post?.id, from: 'HotOrNotVote.placeVote', diff --git a/packages/web-client/src/components/layout/PlayerLayout.svelte b/packages/web-client/src/components/layout/PlayerLayout.svelte index 2446c1fd1..db7c4c2ad 100644 --- a/packages/web-client/src/components/layout/PlayerLayout.svelte +++ b/packages/web-client/src/components/layout/PlayerLayout.svelte @@ -181,7 +181,7 @@ async function updateStats() { post.publisher_canister_id, ).update_post_add_view_details(post.id, payload) } catch (e) { - Log('error', 'Could not update watch stats', { + Log('warn', 'Could not update watch stats', { from: 'PlayerLayout.updateStats', i: index, payload, @@ -279,7 +279,7 @@ $: avatarUrl =
+ class="pointer-events-auto flex max-w-16 shrink-0 flex-col items-end justify-end space-y-6 pb-2"> {#if showReportButton} {
{:else if $playerState.muted || !playing} -
+
{#if !playing} { idb = await (await import('$lib/idb')).idb canId = await idb.get('canisters', id) } catch (e) { - Log('error', 'Error while accessing IDB', { + Log('warn', 'Error while accessing IDB', { error: e, from: 'canisterId.getCanisterId', type: 'idb', @@ -40,7 +40,7 @@ export async function getCanisterId(id: string): Promise { } } } catch (e) { - Log('error', 'Error while fetching canisterId', { + Log('warn', 'Error while fetching canisterId', { error: e, from: 'canisterId.getCanisterId', }) diff --git a/packages/web-client/src/lib/helpers/feed.ts b/packages/web-client/src/lib/helpers/feed.ts index 7c8d67410..c8223f4bd 100644 --- a/packages/web-client/src/lib/helpers/feed.ts +++ b/packages/web-client/src/lib/helpers/feed.ts @@ -50,7 +50,7 @@ async function filterPosts( ) return filtered } catch (e) { - Log('error', 'Error while accessing IDB', { + Log('warn', 'Error while accessing IDB', { error: e, from: 'feed.filterPosts', type: 'idb', @@ -71,7 +71,7 @@ async function filterReportedPosts(posts: PostScoreIndexItem[]) { ) return filtered } catch (e) { - Log('error', 'Error while accessing IDB', { + Log('warn', 'Error while accessing IDB', { error: e, from: 'feed.filterReportedPosts', type: 'idb', @@ -93,7 +93,7 @@ async function filterStuckCanisterPosts(posts: PostScoreIndexItem[]) { (o) => !stuckCanisters.includes(o.publisher_canister_id.toText()), ) } catch (e) { - Log('error', 'Error while accessing IDB', { + Log('warn', 'Error while accessing IDB', { error: e, from: 'feed.filterReportedPosts', type: 'idb', @@ -116,7 +116,7 @@ export async function getWatchedVideosFromCache( const sorted = values.sort((a, b) => a.watched_at - b.watched_at) return sorted } catch (e) { - Log('error', 'Error while accessing IDB', { + Log('warn', 'Error while accessing IDB', { error: e, from: 'feed.getWatchedVideosFromCache', type: 'idb', @@ -167,7 +167,7 @@ export async function getTopPosts( } } else throw new Error(`Unknown response, ${JSON.stringify(res)}`) } catch (e) { - Log('error', 'Error while loading posts', { + Log('warn', 'Error while loading posts', { error: e, from: 'feed.getTopPosts', }) @@ -189,7 +189,7 @@ async function filterBets( ) return filtered } catch (e) { - Log('error', 'Error while accessing IDB', { + Log('warn', 'Error while accessing IDB', { error: e, from: 'feed.filterPosts', type: 'idb', @@ -238,7 +238,7 @@ export async function getHotOrNotPosts( } } else throw new Error(`Unknown response, ${JSON.stringify(res)}`) } catch (e) { - Log('error', 'Error while loading posts', { + Log('warn', 'Error while loading posts', { error: e, from: 'feed.getHotOrNotPosts', }) @@ -303,7 +303,7 @@ async function fetchPostDetailById( publisher_canister_id: post.publisher_canister_id.toText(), } as PostPopulated } catch (e) { - Log('error', 'Error while populating post', { + Log('warn', 'Error while populating post', { error: e, post, from: 'feed.populatePosts.fetch', @@ -340,7 +340,7 @@ async function populatePosts( error: false, } } catch (e) { - Log('error', 'Error while loading posts', { + Log('warn', 'Error while loading posts', { error: e, from: 'feed.populatePosts', }) @@ -369,7 +369,7 @@ export async function updatePostInWatchHistory( postHistory, ) } catch (e) { - Log('error', 'Error while accessing IDB', { + Log('warn', 'Error while accessing IDB', { error: e, from: 'feed.updatePostInWatchHistory', type: 'idb', @@ -384,7 +384,7 @@ export async function saveReportedPostInDb(postId: string, reason: string) { } await idb.set('reported', postId, reason) } catch (e) { - Log('error', 'Error while accessing IDB', { + Log('warn', 'Error while accessing IDB', { error: e, from: 'feed.saveReportedPostInDb', type: 'idb', diff --git a/packages/web-client/src/lib/helpers/profile.ts b/packages/web-client/src/lib/helpers/profile.ts index b6f2e60c3..29ff1ec85 100644 --- a/packages/web-client/src/lib/helpers/profile.ts +++ b/packages/web-client/src/lib/helpers/profile.ts @@ -39,7 +39,7 @@ async function fetchProfile() { try { return await individualUser().get_profile_details() } catch (e) { - Log('error', 'Could not fetch user profile', { + Log('warn', 'Could not fetch user profile', { error: e, from: 'profile.fetchProfile', }) @@ -178,7 +178,7 @@ export async function fetchPosts( } } else throw new Error(`Unknown response, ${JSON.stringify(res)}`) } catch (e) { - Log('error', 'Error while loading posts', { + Log('warn', 'Error while loading posts', { error: e, from: 'profile.fetchPosts', }) @@ -206,7 +206,7 @@ export async function fetchSpeculations( noMorePosts: res.length < 10, } } catch (e) { - Log('error', 'Error while loading posts', { + Log('warn', 'Error while loading posts', { error: e, from: 'profile.fetchSpeculations', }) @@ -244,7 +244,7 @@ async function populatePosts(posts: PlacedBetDetail[]) { error: false, } } catch (e) { - Log('error', 'Error while loading posts', { + Log('warn', 'Error while loading posts', { error: e, from: 'profile.populatePosts', }) @@ -274,7 +274,7 @@ export async function fetchLovers(id: string, from?: bigint) { noMoreLovers: res.length < 9, } } catch (e) { - Log('error', 'Error while loading followers', { + Log('warn', 'Error while loading followers', { error: e, from: 'profile.fetchLovers', }) @@ -304,7 +304,7 @@ export async function fetchLovingUsers(id: string, from?: bigint) { noMoreLovers: res.length < 10, } } catch (e) { - Log('error', 'Error while loading followers', { + Log('warn', 'Error while loading followers', { error: e, from: 'profile.fetchLovingUsers', }) @@ -345,7 +345,7 @@ async function populateProfiles(list: Array<[bigint, FollowEntryDetail]>) { error: false, } } catch (e) { - Log('error', 'Error while loading profile', { + Log('warn', 'Error while loading profile', { error: e, from: 'profile.populateProfiles', }) @@ -369,7 +369,7 @@ export async function doIFollowThisUser(principalId?: string) { }) return !!res['Ok'] } catch (e) { - Log('error', 'Error while loading following status', { + Log('warn', 'Error while loading following status', { error: e, from: 'profile.doIFollowThisUser', }) @@ -399,7 +399,7 @@ export async function loveUser(principalId: string) { return false } } catch (e) { - Log('error', 'Error while following a status', { + Log('warn', 'Error while following a status', { error: e, from: 'profile.loveUser', }) @@ -502,7 +502,7 @@ export async function setBetDetailToDb( const idb = (await import('$lib/idb')).idb idb.set('bets', post.publisher_canister_id + '@' + post.post_id, betDetail) } catch (e) { - Log('error', 'Error while accessing IDB', { + Log('warn', 'Error while accessing IDB', { error: e, from: 'profile.setBetDetailToDb', type: 'idb', @@ -540,7 +540,7 @@ export async function fetchHistory( } } else throw new Error(`Unknown response, ${JSON.stringify(res)}`) } catch (e) { - Log('error', 'Error while loading transaction history', { + Log('warn', 'Error while loading transaction history', { error: e, from: 'profile.fetchHistory', }) @@ -605,7 +605,7 @@ export async function fetchNotifications( } } else throw new Error(`Unknown response, ${JSON.stringify(res)}`) } catch (e) { - Log('error', 'Error while loading transaction history', { + Log('warn', 'Error while loading transaction history', { error: e, from: 'profile.fetchNotifications', }) @@ -621,7 +621,7 @@ export async function fetchTokenBalance(): Promise< const res = await individualUser().get_utility_token_balance() return { error: false, balance: Number(res) } } catch (e) { - Log('error', 'Error while loading token balance', { + Log('warn', 'Error while loading token balance', { error: e, from: 'profile.fetchTokenBalance', }) diff --git a/packages/web-client/src/lib/idb/db.ts b/packages/web-client/src/lib/idb/db.ts index e42754544..f1c1c89e5 100644 --- a/packages/web-client/src/lib/idb/db.ts +++ b/packages/web-client/src/lib/idb/db.ts @@ -34,7 +34,7 @@ const dbPromise = openDB('hot-or-not-web-client', 8, { } }, }).catch((e) => { - Log('error', 'Error while accessing IDB', { + Log('warn', 'Error while accessing IDB', { error: e, from: 'db.openDB', type: 'idb', diff --git a/packages/web-client/src/routes/(feed)/(splash)/feed/[id=videoId]/+page.svelte b/packages/web-client/src/routes/(feed)/(splash)/feed/[id=videoId]/+page.svelte index 45880efd0..f98c80b01 100644 --- a/packages/web-client/src/routes/(feed)/(splash)/feed/[id=videoId]/+page.svelte +++ b/packages/web-client/src/routes/(feed)/(splash)/feed/[id=videoId]/+page.svelte @@ -94,7 +94,7 @@ async function fetchNextVideos(force = false) { source: 'feed.fetchNextVideos', }) } catch (e) { - Log('error', 'Could not fetch videos for feed', { + Log('warn', 'Could not fetch videos for feed', { error: e, noMoreVideos, source: 'feed.fetchNextVideos', diff --git a/packages/web-client/src/routes/(feed)/(splash)/feed/[id=videoId]/+page.ts b/packages/web-client/src/routes/(feed)/(splash)/feed/[id=videoId]/+page.ts index ba6c05214..19c551d0b 100644 --- a/packages/web-client/src/routes/(feed)/(splash)/feed/[id=videoId]/+page.ts +++ b/packages/web-client/src/routes/(feed)/(splash)/feed/[id=videoId]/+page.ts @@ -18,7 +18,7 @@ export const load: PageLoad = async ({ params, fetch }) => { const { idb } = await import('$lib/idb') cachedPost = await idb.get('watch', params.id) } catch (e) { - Log('error', 'Error while accessing IDB', { + Log('warn', 'Error while accessing IDB', { error: e, from: 'feed.videoFeedLoad', type: 'idb', diff --git a/packages/web-client/src/routes/(feed)/(splash)/hotornot/[id=videoId]/+page.svelte b/packages/web-client/src/routes/(feed)/(splash)/hotornot/[id=videoId]/+page.svelte index d43255693..784b59a87 100644 --- a/packages/web-client/src/routes/(feed)/(splash)/hotornot/[id=videoId]/+page.svelte +++ b/packages/web-client/src/routes/(feed)/(splash)/hotornot/[id=videoId]/+page.svelte @@ -94,7 +94,7 @@ async function fetchNextVideos(force = false) { source: 'hotOrNot.fetchNextVideos', }) } catch (e) { - Log('error', 'Could not fetch videos for feed', { + Log('warn', 'Could not fetch videos for feed', { error: e, noMoreVideos, source: 'hotOrNot.fetchNextVideos', diff --git a/packages/web-client/src/routes/(feed)/(splash)/hotornot/[id=videoId]/+page.ts b/packages/web-client/src/routes/(feed)/(splash)/hotornot/[id=videoId]/+page.ts index b9b052f14..4ee811d7d 100644 --- a/packages/web-client/src/routes/(feed)/(splash)/hotornot/[id=videoId]/+page.ts +++ b/packages/web-client/src/routes/(feed)/(splash)/hotornot/[id=videoId]/+page.ts @@ -18,7 +18,7 @@ export const load: PageLoad = async ({ params, fetch }) => { const { idb } = await import('$lib/idb') cachedPost = await idb.get('watch', params.id) } catch (e) { - Log('error', 'Error while accessing IDB', { + Log('warn', 'Error while accessing IDB', { error: e, from: 'feedLoad', type: 'idb', diff --git a/packages/web-client/src/routes/(feed)/notifications/+page.svelte b/packages/web-client/src/routes/(feed)/notifications/+page.svelte index a2ac8c13b..67e0188ec 100644 --- a/packages/web-client/src/routes/(feed)/notifications/+page.svelte +++ b/packages/web-client/src/routes/(feed)/notifications/+page.svelte @@ -40,7 +40,7 @@ async function loadTransactions() { fetchedTransactionsCount = transactions.length loading = false } catch (e) { - Log('error', 'Error while loading transaction history', { + Log('warn', 'Error while loading transaction history', { error: e, from: 'notifications.loadTransactions', }) diff --git a/packages/web-client/src/routes/(feed)/wallet/transactions/+page.svelte b/packages/web-client/src/routes/(feed)/wallet/transactions/+page.svelte index 6231159e7..49d4e755d 100644 --- a/packages/web-client/src/routes/(feed)/wallet/transactions/+page.svelte +++ b/packages/web-client/src/routes/(feed)/wallet/transactions/+page.svelte @@ -38,7 +38,7 @@ async function loadTransactions() { fetchedTransactionsCount = transactions.length loading = false } catch (e) { - Log('error', 'Error while loading transaction history', { + Log('warn', 'Error while loading transaction history', { error: e, from: 'transactions.loadLovers', }) diff --git a/packages/web-client/src/routes/+error.svelte b/packages/web-client/src/routes/+error.svelte index 034c59986..f9745c343 100644 --- a/packages/web-client/src/routes/+error.svelte +++ b/packages/web-client/src/routes/+error.svelte @@ -11,7 +11,7 @@ function getVariant() { return Math.random() < 0.5 ? 'hot-logo' : 'not-logo' } -Log('error', 'Page load error', { +Log('warn', 'Page load error', { details: error, status, from: 'errorPage', diff --git a/packages/web-client/src/routes/profile/[id]/edit/+page.svelte b/packages/web-client/src/routes/profile/[id]/edit/+page.svelte index 2032930c9..214a7131b 100644 --- a/packages/web-client/src/routes/profile/[id]/edit/+page.svelte +++ b/packages/web-client/src/routes/profile/[id]/edit/+page.svelte @@ -119,7 +119,7 @@ async function saveChanges() { const { idb } = await import('$lib/idb') idb.set('canisters', newUsername, canId) } catch (e) { - Log('error', 'Error while accessing IDB', { + Log('warn', 'Error while accessing IDB', { error: e, from: 'edit.saveChanges', type: 'idb', diff --git a/packages/web-client/src/routes/profile/[id]/lovers/+page.svelte b/packages/web-client/src/routes/profile/[id]/lovers/+page.svelte index a26359a30..3bf18b6e0 100644 --- a/packages/web-client/src/routes/profile/[id]/lovers/+page.svelte +++ b/packages/web-client/src/routes/profile/[id]/lovers/+page.svelte @@ -60,7 +60,7 @@ async function loadLovers() { } loading = false } catch (e) { - Log('error', 'Error while loading followers', { + Log('warn', 'Error while loading followers', { error: e, from: 'lovers.loadLovers', }) diff --git a/packages/web-client/src/routes/profile/[id]/loving/+page.svelte b/packages/web-client/src/routes/profile/[id]/loving/+page.svelte index 749af1321..b7921c245 100644 --- a/packages/web-client/src/routes/profile/[id]/loving/+page.svelte +++ b/packages/web-client/src/routes/profile/[id]/loving/+page.svelte @@ -60,7 +60,7 @@ async function loadLovingUsers() { } loading = false } catch (e) { - Log('error', 'Error while loading followers', { + Log('warn', 'Error while loading followers', { error: e, from: 'profile.loadLovingUsers', })