Skip to content

Commit

Permalink
fix(azure_voice.py): log error details instead of cancellation details
Browse files Browse the repository at this point in the history
  • Loading branch information
lanvent committed Apr 27, 2023
1 parent be258e5 commit 9fea949
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions voice/azure/azure_voice.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def voiceToText(self, voice_file):
logger.info("[Azure] voiceToText voice file name={} text={}".format(voice_file, result.text))
reply = Reply(ReplyType.TEXT, result.text)
else:
logger.error("[Azure] voiceToText error, result={}, canceldetails={}".format(result, result.cancellation_details))
cancel_details = result.cancellation_details
logger.error("[Azure] voiceToText error, result={}, errordetails={}".format(result, cancel_details.error_details))
reply = Reply(ReplyType.ERROR, "抱歉,语音识别失败")
return reply

Expand All @@ -88,6 +89,7 @@ def textToVoice(self, text):
logger.info("[Azure] textToVoice text={} voice file name={}".format(text, fileName))
reply = Reply(ReplyType.VOICE, fileName)
else:
logger.error("[Azure] textToVoice error, result={}, canceldetails={}".format(result, result.cancellation_details))
cancel_details = result.cancellation_details
logger.error("[Azure] textToVoice error, result={}, errordetails={}".format(result, cancel_details.error_details))
reply = Reply(ReplyType.ERROR, "抱歉,语音合成失败")
return reply

0 comments on commit 9fea949

Please sign in to comment.