fix(api): surface YouTube action failures as 422, not 502

Same fix as the subscribe reconcile, applied to the remaining endpoints that
wrapped a YouTubeError in a 502: video lookup (feed) and playlist refresh,
push-plan, sync, and delete. A 502 is treated by the client as a transient
"connection lost" blip, so a real, explainable YouTube failure showed the wrong
message. 422 carries the clear detail to the error dialog instead.
This commit is contained in:
npeter83 2026-06-19 04:27:22 +02:00
parent 0d5e2dc331
commit fa86e3d282
2 changed files with 5 additions and 5 deletions

View file

@ -552,7 +552,7 @@ def get_video_detail(
with quota.attribute(user.id, "video_lookup"), YouTubeClient(db, user) as yt:
items = yt.get_videos([video_id])
except YouTubeError as exc:
raise HTTPException(status_code=502, detail=f"YouTube lookup failed: {exc}")
raise HTTPException(status_code=422, detail=f"YouTube lookup failed: {exc}")
if not items:
raise HTTPException(status_code=404, detail="Unknown video")