Skip to content

Commit

Permalink
Replacing an error message 415 (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
iskomir authored Apr 21, 2024
1 parent dce15a7 commit 78a03fe
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions migrations/versions/14de3a5684ea_bigint.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-02-22 21:30:21.156049
"""

import sqlalchemy as sa
from alembic import op

Expand Down
1 change: 1 addition & 0 deletions migrations/versions/56584d8792af_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-01-12 18:59:05.426265
"""

import sqlalchemy as sa
from alembic import op

Expand Down
1 change: 1 addition & 0 deletions migrations/versions/bd42bc6088a1_nullable.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-02-22 21:18:53.212500
"""

import sqlalchemy as sa
from alembic import op

Expand Down
1 change: 1 addition & 0 deletions src/answers.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class Answers:
'<b>{}</b>\n\n'
'Для быстрой печати отсканируйте QR код на экране принтера.'
)
unreadable_file_error = '⚠️ Я не смог прочитать файл {}. Проверьте его целостность и формат, я работаю только с pdf.'
qr_print = '{}{}'
settings_warning = 'Настройки сохраняются автоматически.'
settings_change_fail = 'Что-то сломалось, настройки печати не изменены, попробуйте через пару минут.'
Expand Down
9 changes: 9 additions & 0 deletions src/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@ async def handler_print(update: Update, context: ContextTypes.DEFAULT_TYPE):
)
logging.warning(f'{log_actor(update)} print api 413 SizeErr')
return

elif r.status_code == 415:
await update.message.reply_text(
text=ans.unreadable_file_error.format(update.message.document.file_name),
reply_to_message_id=update.message.id,
parse_mode=ParseMode('HTML'),
)
logging.warning(f'{log_actor(update)} print api 415 UnreadableErr')
return
await context.bot.send_message(
chat_id=update.effective_user.id,
text=ans.print_err,
Expand Down

0 comments on commit 78a03fe

Please sign in to comment.