diff --git a/backend/app/fetch/fundamentals.py b/backend/app/fetch/fundamentals.py index a2db16d..97f2e21 100644 --- a/backend/app/fetch/fundamentals.py +++ b/backend/app/fetch/fundamentals.py @@ -63,8 +63,10 @@ def _fetch_one(code: str, target: date) -> Fundamentals | None: try: cap_df = krx.get_market_cap(ds, ds, code) fund_df = krx.get_market_fundamental(ds, ds, code) - except Exception: # noqa: BLE001 - logger.exception("pykrx fundamentals failed code=%s date=%s", code, ds) + except Exception as exc: # noqa: BLE001 + # logger.exception 은 예전에 pykrx/KRX 비정상 응답 traceback 포매팅 중 + # UnicodeDecodeError 로 API 500 을 만든 적이 있음 → %r 로 안전하게 직렬화. + logger.error("pykrx fundamentals failed code=%s date=%s err=%r", code, ds, exc) return None cap_ok = cap_df is not None and not cap_df.empty