fix(voice): restore failed transcription recovery
This commit is contained in:
18
pages/feedback/voice-actions.ts
Normal file
18
pages/feedback/voice-actions.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
export async function runWithSessionRefresh<T>(
|
||||
action: () => Promise<T>,
|
||||
refreshSession: () => Promise<void>
|
||||
): Promise<T> {
|
||||
let result: T
|
||||
try {
|
||||
result = await action()
|
||||
} catch (error) {
|
||||
try {
|
||||
await refreshSession()
|
||||
} catch {
|
||||
// Preserve the actionable API error and its request ID.
|
||||
}
|
||||
throw error
|
||||
}
|
||||
await refreshSession()
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user