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

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

View File

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