diff --git a/docs/superpowers/plans/2026-08-04-컷별-댓글-추천.md b/docs/superpowers/plans/2026-08-04-컷별-댓글-추천.md index 2b34a2b..5c52695 100644 --- a/docs/superpowers/plans/2026-08-04-컷별-댓글-추천.md +++ b/docs/superpowers/plans/2026-08-04-컷별-댓글-추천.md @@ -502,8 +502,8 @@ def ai_pick_cuts(cuts, comments, quotas, *, model: str = AI_MODEL, try: prompt = prompts.load_recommend().format( cuts=_cut_lines(cuts), comments=_candidate_lines(comments), k=k) - except (KeyError, IndexError, OSError): # 사용자가 프롬프트를 깨뜨린 경우 - return {} + except (KeyError, IndexError, ValueError, OSError): # 사용자가 프롬프트를 깨뜨린 경우 + return {} # ValueError: str.format 은 중괄호가 깨지면 이걸 던진다 body = { "contents": [{"parts": [{"text": prompt}]}], "generationConfig": {"temperature": 0.3, @@ -518,8 +518,9 @@ def ai_pick_cuts(cuts, comments, quotas, *, model: str = AI_MODEL, with urllib.request.urlopen(req, timeout=timeout) as resp: data = json.loads(resp.read().decode("utf-8")) raw = data["candidates"][0]["content"]["parts"][0]["text"] - except (urllib.error.URLError, KeyError, IndexError, TimeoutError, - json.JSONDecodeError, OSError): + # URLError·TimeoutError 는 OSError 서브클래스라 따로 안 적는다. + # ValueError 는 .decode("utf-8") 의 UnicodeDecodeError 를 덮는다(OSError 가 아니다). + except (KeyError, IndexError, json.JSONDecodeError, ValueError, OSError): return {} # 429 포함 — 폴백은 호출부 몫 return _parse_ai(raw) ```