Skip to content

Commit

Permalink
Warn
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh-mn-yral committed Dec 21, 2023
1 parent 9c627bc commit dc677ea
Show file tree
Hide file tree
Showing 20 changed files with 50 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
})
Expand Down Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions packages/web-client/src/components/layout/PlayerLayout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -279,7 +279,7 @@ $: avatarUrl =
</div>

<div
class="max-w-16 pointer-events-auto flex shrink-0 flex-col items-end justify-end space-y-6 pb-2">
class="pointer-events-auto flex max-w-16 shrink-0 flex-col items-end justify-end space-y-6 pb-2">
{#if showReportButton}
<IconButton
iconName="flag"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function loadPosts() {
} catch (e) {
error = true
loading = false
Log('error', 'Error while loading posts', {
Log('warn', 'Error while loading posts', {
error: e,
from: 'ProfilePosts.loadPosts',
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async function loadPosts() {
} catch (e) {
error = true
loading = false
Log('error', 'Error while loading posts', {
Log('warn', 'Error while loading posts', {
error: e,
from: 'SpeculationPosts.speculationsLoadPosts',
})
Expand Down
6 changes: 3 additions & 3 deletions packages/web-client/src/components/video/VideoPlayer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const stop = debounce(
videoEl.pause()
}
} catch (e: any) {
Log('error', 'Error in video playback', {
Log('warn', 'Error in video playback', {
error: e,
index,
uid,
Expand Down Expand Up @@ -126,7 +126,7 @@ async function handleClick() {
}
}
} catch (e) {
Log('error', 'Error in video playback', {
Log('warn', 'Error in video playback', {
error: e,
index,
uid,
Expand Down Expand Up @@ -244,7 +244,7 @@ onDestroy(() => {
</div>
</div>
{:else if $playerState.muted || !playing}
<div class="fade-in max-w-16 pointer-events-none absolute inset-0 z-[5]">
<div class="fade-in pointer-events-none absolute inset-0 z-[5] max-w-16">
<div class="flex h-full items-center justify-center">
{#if !playing}
<Icon
Expand Down
4 changes: 2 additions & 2 deletions packages/web-client/src/lib/helpers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ async function updateUserIndexCanister(): Promise<{
userCanisterPrincipal.toText(),
)
} catch (e) {
Log('error', 'Error while accessing IDB', {
Log('warn', 'Error while accessing IDB', {
error: e,
source: 'auth.updateUserIndexCanister',
type: 'idb',
Expand All @@ -105,7 +105,7 @@ async function updateUserIndexCanister(): Promise<{
if (authFailed) {
await logout()
} else {
Log('error', 'Failed to authenticate', {
Log('warn', 'Failed to authenticate', {
error: e,
from: 'auth.updateUserIndexCanister',
})
Expand Down
4 changes: 2 additions & 2 deletions packages/web-client/src/lib/helpers/canisterId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function getCanisterId(id: string): Promise<string | undefined> {
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',
Expand Down Expand Up @@ -40,7 +40,7 @@ export async function getCanisterId(id: string): Promise<string | undefined> {
}
}
} catch (e) {
Log('error', 'Error while fetching canisterId', {
Log('warn', 'Error while fetching canisterId', {
error: e,
from: 'canisterId.getCanisterId',
})
Expand Down
22 changes: 11 additions & 11 deletions packages/web-client/src/lib/helpers/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
})
Expand All @@ -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',
Expand Down Expand Up @@ -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',
})
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
})
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down
26 changes: 13 additions & 13 deletions packages/web-client/src/lib/helpers/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
})
Expand Down Expand Up @@ -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',
})
Expand Down Expand Up @@ -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',
})
Expand Down Expand Up @@ -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',
})
Expand Down Expand Up @@ -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',
})
Expand Down Expand Up @@ -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',
})
Expand Down Expand Up @@ -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',
})
Expand All @@ -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',
})
Expand Down Expand Up @@ -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',
})
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
})
Expand Down Expand Up @@ -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',
})
Expand All @@ -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',
})
Expand Down
2 changes: 1 addition & 1 deletion packages/web-client/src/lib/idb/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Loading

0 comments on commit dc677ea

Please sign in to comment.