fix: replace all silent .catch(() => {}) with console.warn (BUG-F2)
13 silent catch handlers replaced with descriptive console.warn logging across 6 frontend files. No silent error swallowing remains. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
e5ed856df9
commit
b4900cb66f
@@ -468,7 +468,7 @@ async function _doReplay() {
|
||||
scene.startTalking('a')
|
||||
}
|
||||
// Ensure bubble stays visible for at least 400ms even if TTS resolves instantly
|
||||
const minBubbleA = sleep(400).catch(() => {})
|
||||
const minBubbleA = sleep(400).catch(err => console.warn('[FightViewer] sleep interrupted:', err))
|
||||
if (doTTS) {
|
||||
if (isCodeRound) await sfxModem()
|
||||
else await playAnswerNow(props.fight.botA!.name, round.botAResponse)
|
||||
@@ -495,7 +495,7 @@ async function _doReplay() {
|
||||
scene.showSpeechBubble('b', round.botBResponse, 8)
|
||||
scene.startTalking('b')
|
||||
}
|
||||
const minBubbleB = sleep(400).catch(() => {})
|
||||
const minBubbleB = sleep(400).catch(err => console.warn('[FightViewer] sleep interrupted:', err))
|
||||
if (doTTS) {
|
||||
if (isCodeRound) await sfxModem()
|
||||
else await playAnswerNow(props.fight.botB!.name, round.botBResponse)
|
||||
|
||||
@@ -126,7 +126,7 @@ if (!autoRestoreRan && pubkey.value && !bot.value && getToken() && !isTokenExpir
|
||||
bot.value = normalizeBotData(data.bot)
|
||||
store('bf_bot', bot.value)
|
||||
}
|
||||
}).catch(() => {})
|
||||
}).catch(err => console.warn('[Nostr] auto-restore failed:', err))
|
||||
} else if (!autoRestoreRan && pubkey.value && !getToken()) {
|
||||
// No JWT — clear stale pubkey from before the JWT migration
|
||||
autoRestoreRan = true
|
||||
@@ -224,7 +224,7 @@ export function useNostr() {
|
||||
fetchNostrProfilePic(result.pubkey).then(pic => {
|
||||
profilePicUrl.value = pic
|
||||
store('bf_pic', pic)
|
||||
}).catch(() => {})
|
||||
}).catch(err => console.warn('[Nostr] relay profile fetch failed:', err))
|
||||
} else {
|
||||
freshlyGenerated = false
|
||||
profilePicUrl.value = null
|
||||
@@ -285,7 +285,7 @@ export function useNostr() {
|
||||
fetchNostrProfilePic(result.pubkey).then(pic => {
|
||||
profilePicUrl.value = pic
|
||||
store('bf_pic', pic)
|
||||
}).catch(() => {})
|
||||
}).catch(err => console.warn('[Nostr] profile pic fetch failed:', err))
|
||||
|
||||
return result
|
||||
} finally {
|
||||
|
||||
@@ -29,7 +29,7 @@ export function initCtx() {
|
||||
export function getCtx(): AudioContext {
|
||||
if (!ctx) initCtx()
|
||||
if (ctx!.state === 'suspended') {
|
||||
ctx!.resume().catch(() => {})
|
||||
ctx!.resume().catch(err => console.warn('[Audio] context resume failed:', err))
|
||||
}
|
||||
return ctx!
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ const _inflight = new Map<string, Promise<AudioBuffer | null>>()
|
||||
|
||||
function getAudioCtx(): AudioContext {
|
||||
if (!_audioCtx) _audioCtx = new AudioContext()
|
||||
if (_audioCtx.state === 'suspended') _audioCtx.resume().catch(() => {})
|
||||
if (_audioCtx.state === 'suspended') _audioCtx.resume().catch(err => console.warn('[TTS] AudioContext resume failed:', err))
|
||||
return _audioCtx
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ export function kokoroSpeak(
|
||||
if (staticUrl || _workerReady) {
|
||||
_generateAndCache(text, profileName).then(buf => {
|
||||
if (buf) _playBuffer(buf, dest, volume)
|
||||
}).catch(() => {})
|
||||
}).catch(err => console.warn('[TTS] cache generation failed:', err))
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -514,7 +514,7 @@ export function kokoroSpeak(
|
||||
/** Pre-generate audio in the worker so it's cached when needed. Fire-and-forget. */
|
||||
export function kokoroPrefetch(text: string, profileName: string): void {
|
||||
if (!_workerReady) return
|
||||
_generateAndCache(text, profileName).catch(() => {})
|
||||
_generateAndCache(text, profileName).catch(err => console.warn('[TTS] pre-cache generation failed:', err))
|
||||
}
|
||||
|
||||
/** Await until prefetched audio is cached and ready (max 2s). Returns true if cached, false on timeout/failure. */
|
||||
|
||||
@@ -285,7 +285,7 @@ onMounted(async () => {
|
||||
if (stats.value?.ownerPubkey) {
|
||||
fetchNostrProfile(stats.value.ownerPubkey).then(p => {
|
||||
nostrProfile.value = p
|
||||
}).catch(() => {})
|
||||
}).catch(err => console.warn('[BotProfile] webhook test failed:', err))
|
||||
}
|
||||
|
||||
// Poll queue for "choose your fight"
|
||||
|
||||
@@ -224,12 +224,12 @@ function wireSSE() {
|
||||
},
|
||||
onRoundEnd(data) {
|
||||
if (_fightEnding) return // Don't start new round animations after fight is ending
|
||||
_roundEndPromise = handleRoundEnd(data).catch(() => {})
|
||||
_roundEndPromise = handleRoundEnd(data).catch(err => console.warn('[FightPage] handleRoundEnd failed:', err))
|
||||
},
|
||||
onFightEnd(data) {
|
||||
if (_fightEnding) return // Deduplicate (only process first fight_end)
|
||||
_fightEnding = true
|
||||
handleFightEnd(data).catch(() => {})
|
||||
handleFightEnd(data).catch(err => console.warn('[FightPage] handleFightEnd failed:', err))
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -517,7 +517,7 @@ onMounted(async () => {
|
||||
|
||||
// Cache finished fights for offline replay
|
||||
if (status === 'finished' && fight.value) {
|
||||
cacheFight(fight.value).catch(() => {})
|
||||
cacheFight(fight.value).catch(err => console.warn('[FightPage] cacheFight failed:', err))
|
||||
}
|
||||
|
||||
isLoading.value = false
|
||||
|
||||
Reference in New Issue
Block a user