From b4c6c370b9cb37f18a644e9450d2e17d27adb0b2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Apr 2026 17:20:08 +0000 Subject: [PATCH] Address code review: fix concatenated f-string, remove dead code, narrow exception catch Agent-Logs-Url: https://github.com/thaitien280401-stack/RedditVideoMakerBot/sessions/0fff9f19-a7aa-44c2-a703-9e5a7ec6d880 Co-authored-by: thaitien280401-stack <271128961+thaitien280401-stack@users.noreply.github.com> --- threads/threads_client.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/threads/threads_client.py b/threads/threads_client.py index 5ed5397..87f6d17 100644 --- a/threads/threads_client.py +++ b/threads/threads_client.py @@ -84,7 +84,7 @@ class ThreadsClient: error_type = err.get("type", "") error_code = err.get("code", 0) raise ThreadsAPIError( - f"Threads API error: {error_msg} " f"(type={error_type}, code={error_code})", + f"Threads API error: {error_msg} (type={error_type}, code={error_code})", error_type=error_type, error_code=error_code, ) @@ -105,11 +105,6 @@ class ThreadsClient: except (ThreadsAPIError, requests.HTTPError): raise - # Should not be reached, but just in case - if last_exception is not None: - raise last_exception - raise RuntimeError("Unexpected retry loop exit") - def validate_token(self) -> dict: """Kiểm tra access token có hợp lệ bằng cách gọi /me endpoint. @@ -300,7 +295,7 @@ def get_threads_posts(POST_ID: str = None) -> dict: f"✅ Token đã refresh - User: @{user_info.get('username', 'N/A')}", style="bold green", ) - except (ThreadsAPIError, Exception) as refresh_err: + except (ThreadsAPIError, requests.RequestException) as refresh_err: print_substep( "❌ Không thể xác thực hoặc refresh token.\n" " Vui lòng lấy token mới từ Meta Developer Portal:\n"