mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 18:50:56 +08:00
fix(useOcr): 修复未支持文件类型错误抛出位置
将不支持的OCR文件类型错误抛出逻辑移至条件判断内
This commit is contained in:
parent
bbf3af070a
commit
1f38428716
@ -32,6 +32,9 @@ export const useOcr = () => {
|
||||
try {
|
||||
if (isImageFile(file)) {
|
||||
return ocrImage(file)
|
||||
} else {
|
||||
// @ts-expect-error all types should be covered
|
||||
throw new Error(t('ocr.file.not_supported', { type: file.type }))
|
||||
}
|
||||
} catch (e) {
|
||||
logger.error('Failed to ocr.', e as Error)
|
||||
@ -40,8 +43,6 @@ export const useOcr = () => {
|
||||
} finally {
|
||||
window.message.destroy(key)
|
||||
}
|
||||
// @ts-expect-error all types should be covered
|
||||
throw new Error(t('ocr.file.not_supported', { type: file.type }))
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user