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 kanazawa.. (unknown [101.128.126.198]) by gnuweeb.org (Postfix) with ESMTPSA id 668638149A; Fri, 4 Nov 2022 18:09:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1667585393; bh=JcuxRBxyb1OsLcybIzXfQUhKpGEt+N58uLjWVIXQgxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YJi0H1mqXn4F0fFcH0HvQTq4nZhcF/X1wHD/A4ToVtPuw545VJTaYOavdQvk3h4AA IBNNNMx8u4vS7fdjSjkxcwlmnBEODPL+GaYC7R08QqmQV2gDfEc0vv5+MpCGRyhnz+ GqP4XkRit8ukojnWcTEdcfFCPgCZYmmq1SkQRXY4hJMYn5dGtvn8Z+Rami6A9QGYf6 0Wh34iVIljgvhQGh+JP6LcHIIrFUUF8san4fXGv9dEOE/dU2rpZX2P8hGEjv2/R8ci 1iLNALnkxPGl0VJhEJ/AaLaWyE5USpBbFIDOnDl8ppYca/UgBUscJ2A38qOjHakZyI nHd01Y+aNhTOA== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v1 06/16] utils: Add catch_err() for the log message Date: Sat, 5 Nov 2022 01:09:13 +0700 Message-Id: <20221104180931.3852-7-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221104180931.3852-1-kiizuha@gnuweeb.org> References: <20221104180931.3852-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Add catch_err() for the logger message in the future use. Signed-off-by: Muhammad Rizki --- daemon/atom/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/daemon/atom/utils.py b/daemon/atom/utils.py index fe3f8d2..60f2c76 100644 --- a/daemon/atom/utils.py +++ b/daemon/atom/utils.py @@ -279,6 +279,12 @@ def get_decoded_payload(payload: Message): return p.encode().decode(charset, errors="replace") +def catch_err(): + return traceback.format_exc() \ + .encode("unicode_escape") \ + .decode("utf-8") + + EMAIL_MSG_ID_PATTERN = r"<([^\<\>]+)>" def extract_email_msg_id(msg_id): ret = re.search(EMAIL_MSG_ID_PATTERN, msg_id) -- Muhammad Rizki