1
0
mirror of https://github.com/ijaric/voice_assistant.git synced 2025-05-24 14:33:26 +00:00

feat: [#49] Improved error display

This commit is contained in:
Григорич 2023-10-14 02:09:04 +03:00
parent 70696ae067
commit 123547b62c

View File

@ -1,3 +1,4 @@
import json
import io
import typing
@ -41,7 +42,11 @@ async def voice_response(message_voice: aiogram.types.Message):
"We were unable to send you a voice message. Please check your privacy settings."
)
else:
await message_voice.answer("Not recognized text")
error_text: str = await resp.text()
if error_text == "":
await message_voice.answer(f"Error: {resp.status}")
else:
await message_voice.answer(f"Error: {json.loads(error_text)['detail']}")
await session.close()
return