From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [175.158.50.43]) by gnuweeb.org (Postfix) with ESMTPSA id 3749F7F937; Wed, 18 Jan 2023 17:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1674064478; bh=eUsvifkUSu9TC5TkZVi/JHYu0K4y3Uew44bCsKWHhTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YWogCsvnUpWwQJsaNHFN/kOA1o990hJIdEjHAIwlQDUu1hT8wKGwoz18aUrZWpSQ7 FgBxZNTkDquUEalNyTtQzdjQUx1TpKxLixspx5S6EfEHvRdR6bERVd+/O7MI7GgdT2 vleuGGxoCFeTz+gJ9s9EOEMLzs6ToaCgEtOVZsyPvzBI6q39nHknpjLQv/SgyDyq2h SzTmqjCqcZrA7xWdqCb0CHy3koKDS8cmLxB2zU0J+FNUUnjNyLinq9YfWMgwMrU1YQ 8OpNZjvRMZjhKpBI/A/iimEhwGzc4BDxzsfl5FbybQrkpKRcwkWY8gcyAjPpjOx7qC 1H5Z2jkyZyccA== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v2 11/17] telegram: Implement DaemonException() and report_err() in scrape.py Date: Thu, 19 Jan 2023 00:53:50 +0700 Message-Id: <20230118175356.1853-12-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20230118175356.1853-1-kiizuha@gnuweeb.org> References: <20230118175356.1853-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: In the last series, I didn't care so much to look into the Telegram's scrape.py command. I've implemented them same as in the listener.py. Signed-off-by: Muhammad Rizki --- daemon/telegram/packages/plugins/commands/scrape.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/daemon/telegram/packages/plugins/commands/scrape.py b/daemon/telegram/packages/plugins/commands/scrape.py index 89581b6..ddcf7f1 100644 --- a/daemon/telegram/packages/plugins/commands/scrape.py +++ b/daemon/telegram/packages/plugins/commands/scrape.py @@ -11,6 +11,7 @@ from atom import Scraper from atom import utils from enums import Platform from telegram import config +from exceptions import DaemonException import re import asyncio @@ -41,9 +42,11 @@ async def scrap_email(c: DaemonTelegram, m: Message): mail = await s.get_email_from_url(url) text, files, is_patch = utils.create_template(mail, Platform.TELEGRAM) except: - exc_str = utils.catch_err() - c.logger.warning(exc_str) - await c.send_log_file(url) + e = DaemonException() + e.set_thread_url(url) + e.set_message(utils.catch_err()) + await c.report_err(e) + return if is_patch: m = await c.send_patch_email( -- Muhammad Rizki