From db79e742688ca91d38cd61977ddad6fff1324b21 Mon Sep 17 00:00:00 2001 From: Redume Date: Fri, 10 Jan 2025 00:12:00 +0300 Subject: [PATCH] chore: Made a check if the currency rate was not found --- main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 5b54d05..bc807dd 100644 --- a/main.py +++ b/main.py @@ -78,12 +78,12 @@ async def currency(query: types.InlineQuery) -> None: )], query) - if not conv_currency or not from_currency: - return await reply(result_id, [('The currency exchange rate could not be found.', None, None)], query) - conv.from_currency = from_currency.upper() conv.conv_currency = conv_currency.upper() - await conv.convert() + try: + await conv.convert() + except RuntimeError as e: + return await reply(result_id, [('The currency exchange rate could not be determined', None, None)], query) chart = await create_chart(from_currency, conv_currency)