mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-05 04:19:02 +08:00
fix(ocr): 修复文件类型与OCR提供者能力不匹配时的错误抛出位置
将错误抛出语句移至else分支
This commit is contained in:
parent
cf0e6a8f73
commit
364a0f8bb7
@ -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.`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user