diff --git a/src/main.py b/src/main.py index aa5fe05..9c65d18 100644 --- a/src/main.py +++ b/src/main.py @@ -142,20 +142,20 @@ def update_podcast_image( if image is not None and image.size > 0: if not (image.filename.endswith(".jpg") or image.filename.endswith(".png")): - return HTTPException( + raise HTTPException( 400, detail="The uploaded podcast image must be a jpg or png" ) im = Image.open(image.file) if im.size[0] != im.size[1] or im.size[0] < 1400 or im.size[0] > 3000: - return HTTPException( + raise HTTPException( 400, detail="The uploaded podcast image must be square and between 1400x1400px and 3000x3000px in size", ) if im.mode != "RGB": - return HTTPException( + raise HTTPException( 400, detail="The uploaded podcast image must be in RGB format" ) @@ -489,7 +489,7 @@ def get_episode_or_cover(session: SessionDep, podcast_id: str, filename: str): ) and filename == podcast.image_filename: return FileResponse(settings.directory / podcast.image_filename) - return HTTPException(status_code=404, detail="File not found") + raise HTTPException(status_code=404, detail="File not found") @app.get("/{full_path:path}") @@ -497,7 +497,7 @@ async def serve_app(full_path: str): if not full_path.startswith("api/"): return FileResponse("dist/index.html") - return HTTPException(status_code=404, detail="Not found") + raise HTTPException(status_code=404, detail="Not found") use_route_names_as_operation_ids(app)