fix: catch get voice error
Signed-off-by: Innei <i@innei.in>
This commit is contained in:
parent
f7afd373de
commit
aefe8d9e32
|
|
@ -45,9 +45,22 @@ export const readerRoute = {
|
|||
}
|
||||
}),
|
||||
|
||||
getVoices: t.procedure.action(async () => {
|
||||
const voices = await tts.getVoices()
|
||||
return voices
|
||||
getVoices: t.procedure.action(async ({ context: { sender } }) => {
|
||||
const window = BrowserWindow.fromWebContents(sender)
|
||||
try {
|
||||
const voices = await tts.getVoices()
|
||||
return voices
|
||||
} catch (error: any) {
|
||||
if (!window) {
|
||||
return
|
||||
}
|
||||
callGlobalContextMethod(window, "toast.error", [
|
||||
error.message,
|
||||
{
|
||||
duration: 1000,
|
||||
},
|
||||
])
|
||||
}
|
||||
}),
|
||||
|
||||
setVoice: t.procedure.input<string>().action(async ({ input, context: { sender } }) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue