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.198]) by gnuweeb.org (Postfix) with ESMTPSA id 1234B804D1; Wed, 9 Nov 2022 02:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1667962235; bh=rTjmJ6n4DgYIEJzr+QLYyA0GKf+kFqK0Camd11ZOI1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t6nw+C927PapQNXhTTwVxtU70VxJMZLZRcZSb2Q97s0+2YB7fByt9twUL2hTeWS/8 AK9+6u6j2hCMHR27hVa2rLB5dNglXpamI8a6hJDCoZopTwvpvbTvaH8KUHtt2dW6QW 4JGs03MWW4ORvTj2j3i4UE0h0lA0qpQFH18JCV5ENyfAJcmWRQt5t4oxYa2hhEA4Pf XUFsfuo2RrNj3BIsEvlZKmm8o7lWyVfcY8X1eAk4TUafNyNTdkrZBg5RCoNHIFv2Ai sYZ/BFcmJsrUbqiOLR4+ceC/1Ep5RdLnPKq1gXMscNfbKfIYrJi62rqaZj0V7Nu8mb 1FN830HVwruig== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v2 07/17] utils: Add catch_err() for the log message Date: Wed, 9 Nov 2022 09:49:52 +0700 Message-Id: <20221109025002.258-8-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221109025002.258-1-kiizuha@gnuweeb.org> References: <20221109025002.258-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 c21a4b5..c85d711 100644 --- a/daemon/atom/utils.py +++ b/daemon/atom/utils.py @@ -274,6 +274,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