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 [101.128.126.135]) by gnuweeb.org (Postfix) with ESMTPSA id 4E1DE7E474; Tue, 3 Jan 2023 06:37:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1672727838; bh=30HFqkXaNZGFRcOQWwcRX0aKqY0vhOMZFYC6SUCwCsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QAP85S1W5C6OuAe/j0bURKOS8fnOdmEXO4eV0hqEe/6t8v7VqaSPIiQqBoW8I6rEK slFIzFOwx65wOMMUa7lv5IH5EebUF+vitp1Ww/oeNyGuCQtEhDWLrSUIKRa5jV64BE FJVkPQWtd2xcWDPQA82CrqkjbhT7YqgHS3rEFP+GRLKdH3uIKN4ua7QicA5r5ngUdU CchUtnNQJVVN/s++WOWCwNnHWdiWeuOmroVhxKpNfRJ24snW+f43X8zeML+vBIfQhh zlxVmBbk8UWq+TqMieLpi/P9eqHYpJAbBFvlYDX7bZJ4R5W8luFAxH/0kCaeovcG0X 4sceOI6zVMxlQ== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v1 08/13] feat(discord): Implement the report_err() Date: Tue, 3 Jan 2023 13:36:36 +0700 Message-Id: <20230103063641.1680-9-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20230103063641.1680-1-kiizuha@gnuweeb.org> References: <20230103063641.1680-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: After report_err() is created within the GWClient() class, implement it in the dscord/mailer/listener.py for reporting error log to the Discord channel. Signed-off-by: Muhammad Rizki --- daemon/dscord/mailer/listener.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/daemon/dscord/mailer/listener.py b/daemon/dscord/mailer/listener.py index a225f46..b45c9d0 100644 --- a/daemon/dscord/mailer/listener.py +++ b/daemon/dscord/mailer/listener.py @@ -51,8 +51,13 @@ class Listener: async def __run(self): self.logger.info("Running...") - for url in self.db.get_atom_urls(): - await self.__handle_atom_url(url) + url = None + + try: + for url in self.db.get_atom_urls(): + await self.__handle_atom_url(url) + except: + await self.client.report_err(url) if not self.isRunnerFixed: self.isRunnerFixed = True @@ -72,9 +77,8 @@ class Listener: mail = await self.scraper.get_email_from_url(url) await self.__handle_mail(url, mail) except: - exc_str = utils.catch_err() - self.client.logger.warning(exc_str) - await self.client.send_log_file(url) + # this statement will be changed in the next commit + await self.client.report_err(url) async def __handle_mail(self, url, mail): -- Muhammad Rizki