Skip to content

Commit

Permalink
fix: 语音识别失败时增加错误处理
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxinqi committed Apr 3, 2023
1 parent fadbe42 commit 057d9c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/Content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const recognize = async () => {
}
catch (error) {
isRecognizing.value = false
store.changeLoading(true)
store.changeLoading(false)
alert(error)
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/hooks/useSpeechService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ export const useSpeechService = (subscriptionKey: string, region: string, langs
}
else {
isRecognizing.value = false
reject(new Error('语音识别失败'),
reject(new Error(`未识别到任何内容-${language.value}`),
)
}
}, err => {
isRecognizing.value = false
reject(err)
})
})
}
Expand Down

0 comments on commit 057d9c7

Please sign in to comment.