From 43c1747ccb9c4b259867e3cdafde21b5f1280a99 Mon Sep 17 00:00:00 2001 From: Dmitry <124861781+ada-dmitry@users.noreply.github.com> Date: Fri, 12 Dec 2025 10:56:51 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B8=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=BC=D0=B5=D1=82=D0=BE=D0=BA=20=D0=B2=20Trilium?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D1=83=D0=BB=D1=83=D1=87=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D1=81=D1=82=D0=B0=D0=B1=D0=B8=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/main.py b/main.py index 6aa3807..0a7f46b 100644 --- a/main.py +++ b/main.py @@ -154,21 +154,27 @@ async def handler(msg: Message): await msg.answer(f"Добавлено в ежедневную заметку за {today_date}.") else: # Создаём новую заметку на сегодня - ea.create_note( - parentNoteId=day_id, - title=today_date, - content=content, - type="text", - ) - await msg.answer(f"Создана ежедневная заметка за {today_date}.") + try: + ea.create_note( + parentNoteId=day_id, + title=today_date, + content=content, + type="text", + ) + await msg.answer(f"Создана ежедневная заметка за {today_date}.") + except Exception as create_err: + await msg.answer(f"Ошибка при создании заметки: {str(create_err)}") except Exception as e: await msg.answer(f"Ошибка при работе с ежедневной заметкой: {str(e)}") else: # Обычное сохранение в Inbox - ea.create_note( - parentNoteId=INBOX_NOTE_ID, title=title, content=content, type="text" - ) - await msg.answer("Заметка сохранена в Trilium.") + try: + ea.create_note( + parentNoteId=INBOX_NOTE_ID, title=title, content=content, type="text" + ) + await msg.answer("Заметка сохранена в Trilium.") + except Exception as e: + await msg.answer(f"Ошибка при сохранении в Inbox: {str(e)}") async def main():