diff --git a/backend/app/routes/feed.py b/backend/app/routes/feed.py index 8afa915..fb24597 100644 --- a/backend/app/routes/feed.py +++ b/backend/app/routes/feed.py @@ -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") diff --git a/backend/app/routes/playlists.py b/backend/app/routes/playlists.py index b923161..741b2ca 100644 --- a/backend/app/routes/playlists.py +++ b/backend/app/routes/playlists.py @@ -270,7 +270,7 @@ def revert_youtube( return repull_playlist(db, user, pl) except YouTubeError: db.rollback() - raise HTTPException(status_code=502, detail="Couldn't refresh from YouTube.") + raise HTTPException(status_code=422, detail="Couldn't refresh from YouTube.") def _pushable(db: Session, user: User, playlist_id: int) -> Playlist: @@ -301,7 +301,7 @@ def push_plan( with quota.attribute(user.id, "playlist_push"): plan = plan_push(db, user, pl) except YouTubeError: - raise HTTPException(status_code=502, detail="Couldn't read the playlist on YouTube.") + raise HTTPException(status_code=422, detail="Couldn't read the playlist on YouTube.") plan["remaining_today"] = quota.remaining_today(db) plan["affordable"] = plan["units_estimate"] <= plan["remaining_today"] return plan @@ -332,7 +332,7 @@ def push( return push_playlist(db, user, pl) except YouTubeError: db.rollback() - raise HTTPException(status_code=502, detail="YouTube playlist sync failed.") + raise HTTPException(status_code=422, detail="YouTube playlist sync failed.") @router.get("/{playlist_id}") @@ -422,7 +422,7 @@ def delete_playlist( with YouTubeClient(db, user) as yt: yt.delete_playlist(pl.yt_playlist_id) except YouTubeError: - raise HTTPException(status_code=502, detail="YouTube delete failed.") + raise HTTPException(status_code=422, detail="YouTube delete failed.") db.delete(pl) # items cascade db.commit() return {"deleted": playlist_id}