fix(ocr): 修复文件类型与OCR提供者能力不匹配时的错误抛出位置

将错误抛出语句移至else分支
This commit is contained in:
icarus 2025-08-22 20:29:46 +08:00
parent cf0e6a8f73
commit 364a0f8bb7

View File

@ -73,8 +73,9 @@ const imageOcr = async (file: ImageFileMetadata, provider: ImageOcrProvider): Pr
export const ocr = async (file: SupportedOcrFile, provider: OcrProvider): Promise<OcrResult> => { export const ocr = async (file: SupportedOcrFile, provider: OcrProvider): Promise<OcrResult> => {
if (isImageFile(file) && isImageOcrProvider(provider)) { if (isImageFile(file) && isImageOcrProvider(provider)) {
return imageOcr(file, 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.`)
} }
/** /**