From 364a0f8bb7ff7aac3811f64037b93cd6fa8eb2d0 Mon Sep 17 00:00:00 2001 From: icarus Date: Fri, 22 Aug 2025 20:29:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(ocr):=20=E4=BF=AE=E5=A4=8D=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=B1=BB=E5=9E=8B=E4=B8=8EOCR=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E8=80=85=E8=83=BD=E5=8A=9B=E4=B8=8D=E5=8C=B9=E9=85=8D=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E9=94=99=E8=AF=AF=E6=8A=9B=E5=87=BA=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将错误抛出语句移至else分支 --- src/main/services/ocr/OcrService.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/services/ocr/OcrService.ts b/src/main/services/ocr/OcrService.ts index d4fe7eef46..5a52ad7833 100644 --- a/src/main/services/ocr/OcrService.ts +++ b/src/main/services/ocr/OcrService.ts @@ -73,8 +73,9 @@ const imageOcr = async (file: ImageFileMetadata, provider: ImageOcrProvider): Pr export const ocr = async (file: SupportedOcrFile, provider: OcrProvider): Promise => { if (isImageFile(file) && isImageOcrProvider(provider)) { return imageOcr(file, provider) + } else { + throw new Error(`File type and provider capability is not matched, otherwise one of them is not supported.`) } - throw new Error(`File type and provider capability is not matched, otherwise one of them is not supported.`) } /**