From 705310da28dfdf463de76d7d5a4ca150e40f6fad Mon Sep 17 00:00:00 2001 From: vvzvlad Date: Sun, 17 May 2026 22:30:01 +0300 Subject: [PATCH] fix(parser): log channel arg to avoid UnboundLocalError Use the original `channel` argument in the error log instead of `prepared_channel_id` to prevent an UnboundLocalError when an exception is raised during post parsing. --- post_parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/post_parser.py b/post_parser.py index 67de38e..8dbae7d 100644 --- a/post_parser.py +++ b/post_parser.py @@ -110,8 +110,8 @@ class PostParser: return None except Exception as e: - # Log the specific exception type and message - logger.error(f"post_parsing_error: channel {prepared_channel_id}, post_id {post_id}, error_type {type(e).__name__}, error_message {str(e)}") + # Log the specific exception type and message (use original channel arg to avoid UnboundLocalError) + logger.error(f"post_parsing_error: channel {channel}, post_id {post_id}, error_type {type(e).__name__}, error_message {str(e)}") # Optional: include traceback for more detail # import traceback # logger.error(traceback.format_exc())