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')
|
scene.startTalking('a')
|
||||||
}
|
}
|
||||||
// Ensure bubble stays visible for at least 400ms even if TTS resolves instantly
|
// 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 (doTTS) {
|
||||||
if (isCodeRound) await sfxModem()
|
if (isCodeRound) await sfxModem()
|
||||||
else await playAnswerNow(props.fight.botA!.name, round.botAResponse)
|
else await playAnswerNow(props.fight.botA!.name, round.botAResponse)
|
||||||
@@ -495,7 +495,7 @@ async function _doReplay() {
|
|||||||
scene.showSpeechBubble('b', round.botBResponse, 8)
|
scene.showSpeechBubble('b', round.botBResponse, 8)
|
||||||
scene.startTalking('b')
|
scene.startTalking('b')
|
||||||
}
|
}
|
||||||
const minBubbleB = sleep(400).catch(() => {})
|
const minBubbleB = sleep(400).catch(err => console.warn('[FightViewer] sleep interrupted:', err))
|
||||||
if (doTTS) {
|
if (doTTS) {
|
||||||
if (isCodeRound) await sfxModem()
|
if (isCodeRound) await sfxModem()
|
||||||
else await playAnswerNow(props.fight.botB!.name, round.botBResponse)
|
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)
|
bot.value = normalizeBotData(data.bot)
|
||||||
store('bf_bot', bot.value)
|
store('bf_bot', bot.value)
|
||||||
}
|
}
|
||||||
}).catch(() => {})
|
}).catch(err => console.warn('[Nostr] auto-restore failed:', err))
|
||||||
} else if (!autoRestoreRan && pubkey.value && !getToken()) {
|
} else if (!autoRestoreRan && pubkey.value && !getToken()) {
|
||||||
// No JWT — clear stale pubkey from before the JWT migration
|
// No JWT — clear stale pubkey from before the JWT migration
|
||||||
autoRestoreRan = true
|
autoRestoreRan = true
|
||||||
@@ -224,7 +224,7 @@ export function useNostr() {
|
|||||||
fetchNostrProfilePic(result.pubkey).then(pic => {
|
fetchNostrProfilePic(result.pubkey).then(pic => {
|
||||||
profilePicUrl.value = pic
|
profilePicUrl.value = pic
|
||||||
store('bf_pic', pic)
|
store('bf_pic', pic)
|
||||||
}).catch(() => {})
|
}).catch(err => console.warn('[Nostr] relay profile fetch failed:', err))
|
||||||
} else {
|
} else {
|
||||||
freshlyGenerated = false
|
freshlyGenerated = false
|
||||||
profilePicUrl.value = null
|
profilePicUrl.value = null
|
||||||
@@ -285,7 +285,7 @@ export function useNostr() {
|
|||||||
fetchNostrProfilePic(result.pubkey).then(pic => {
|
fetchNostrProfilePic(result.pubkey).then(pic => {
|
||||||
profilePicUrl.value = pic
|
profilePicUrl.value = pic
|
||||||
store('bf_pic', pic)
|
store('bf_pic', pic)
|
||||||
}).catch(() => {})
|
}).catch(err => console.warn('[Nostr] profile pic fetch failed:', err))
|
||||||
|
|
||||||
return result
|
return result
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export function initCtx() {
|
|||||||
export function getCtx(): AudioContext {
|
export function getCtx(): AudioContext {
|
||||||
if (!ctx) initCtx()
|
if (!ctx) initCtx()
|
||||||
if (ctx!.state === 'suspended') {
|
if (ctx!.state === 'suspended') {
|
||||||
ctx!.resume().catch(() => {})
|
ctx!.resume().catch(err => console.warn('[Audio] context resume failed:', err))
|
||||||
}
|
}
|
||||||
return ctx!
|
return ctx!
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ const _inflight = new Map<string, Promise<AudioBuffer | null>>()
|
|||||||
|
|
||||||
function getAudioCtx(): AudioContext {
|
function getAudioCtx(): AudioContext {
|
||||||
if (!_audioCtx) _audioCtx = new 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
|
return _audioCtx
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,7 +505,7 @@ export function kokoroSpeak(
|
|||||||
if (staticUrl || _workerReady) {
|
if (staticUrl || _workerReady) {
|
||||||
_generateAndCache(text, profileName).then(buf => {
|
_generateAndCache(text, profileName).then(buf => {
|
||||||
if (buf) _playBuffer(buf, dest, volume)
|
if (buf) _playBuffer(buf, dest, volume)
|
||||||
}).catch(() => {})
|
}).catch(err => console.warn('[TTS] cache generation failed:', err))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@@ -514,7 +514,7 @@ export function kokoroSpeak(
|
|||||||
/** Pre-generate audio in the worker so it's cached when needed. Fire-and-forget. */
|
/** Pre-generate audio in the worker so it's cached when needed. Fire-and-forget. */
|
||||||
export function kokoroPrefetch(text: string, profileName: string): void {
|
export function kokoroPrefetch(text: string, profileName: string): void {
|
||||||
if (!_workerReady) return
|
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. */
|
/** 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) {
|
if (stats.value?.ownerPubkey) {
|
||||||
fetchNostrProfile(stats.value.ownerPubkey).then(p => {
|
fetchNostrProfile(stats.value.ownerPubkey).then(p => {
|
||||||
nostrProfile.value = p
|
nostrProfile.value = p
|
||||||
}).catch(() => {})
|
}).catch(err => console.warn('[BotProfile] webhook test failed:', err))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Poll queue for "choose your fight"
|
// Poll queue for "choose your fight"
|
||||||
|
|||||||
@@ -224,12 +224,12 @@ function wireSSE() {
|
|||||||
},
|
},
|
||||||
onRoundEnd(data) {
|
onRoundEnd(data) {
|
||||||
if (_fightEnding) return // Don't start new round animations after fight is ending
|
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) {
|
onFightEnd(data) {
|
||||||
if (_fightEnding) return // Deduplicate (only process first fight_end)
|
if (_fightEnding) return // Deduplicate (only process first fight_end)
|
||||||
_fightEnding = true
|
_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
|
// Cache finished fights for offline replay
|
||||||
if (status === 'finished' && fight.value) {
|
if (status === 'finished' && fight.value) {
|
||||||
cacheFight(fight.value).catch(() => {})
|
cacheFight(fight.value).catch(err => console.warn('[FightPage] cacheFight failed:', err))
|
||||||
}
|
}
|
||||||
|
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
|
|||||||
Reference in New Issue
Block a user