Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing an error message 415 #82

Merged
merged 7 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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),
annndruha marked this conversation as resolved.
Show resolved Hide resolved
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
Loading