fix: catch setTTS execption
Signed-off-by: Innei <i@innei.in>
This commit is contained in:
parent
83b4031405
commit
f7afd373de
|
|
@ -2,7 +2,8 @@ import fs from "node:fs"
|
|||
import { createRequire } from "node:module"
|
||||
import path from "node:path"
|
||||
|
||||
import { app } from "electron"
|
||||
import { callGlobalContextMethod } from "@follow/shared/bridge"
|
||||
import { app, BrowserWindow } from "electron"
|
||||
import { MsEdgeTTS, OUTPUT_FORMAT } from "msedge-tts"
|
||||
|
||||
import { readability } from "../lib/readability"
|
||||
|
|
@ -49,8 +50,20 @@ export const readerRoute = {
|
|||
return voices
|
||||
}),
|
||||
|
||||
setVoice: t.procedure.input<string>().action(async ({ input }) => {
|
||||
await tts.setMetadata(input, OUTPUT_FORMAT.WEBM_24KHZ_16BIT_MONO_OPUS)
|
||||
setVoice: t.procedure.input<string>().action(async ({ input, context: { sender } }) => {
|
||||
const window = BrowserWindow.fromWebContents(sender)
|
||||
if (!window) {
|
||||
return
|
||||
}
|
||||
|
||||
await tts.setMetadata(input, OUTPUT_FORMAT.WEBM_24KHZ_16BIT_MONO_OPUS).catch((error) => {
|
||||
callGlobalContextMethod(window, "toast.error", [
|
||||
error.message,
|
||||
{
|
||||
duration: 1000,
|
||||
},
|
||||
])
|
||||
})
|
||||
}),
|
||||
|
||||
detectCodeStringLanguage: t.procedure
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ const ERROR_PATTERNS = [
|
|||
"Unable to open cursor",
|
||||
"Document is not focused.",
|
||||
"HTTP Client Error",
|
||||
// Biz errors
|
||||
"Chain aborted",
|
||||
]
|
||||
|
||||
export const SentryConfig: BrowserOptions = {
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ export const VoiceSelector = () => {
|
|||
<SelectTrigger size="sm" className="w-48">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent className="h-64">
|
||||
<SelectContent position="item-aligned">
|
||||
{data?.map((item) => (
|
||||
<SelectItem key={item.ShortName} value={item.ShortName}>
|
||||
{item.FriendlyName}
|
||||
|
|
|
|||
Loading…
Reference in New Issue