diff --git a/api/routes/books.py b/api/routes/books.py index 27a4ac81a..aa0250c15 100644 --- a/api/routes/books.py +++ b/api/routes/books.py @@ -64,13 +64,11 @@ async def delete_book(book_id: int) -> None: @router.get("/{book_id}", response_model=Book, status_code=status.HTTP_200_OK) -async def get_book(book_id: int): +async def get_book(book_id: int) -> Book: book = db.get_book(book_id) - if not book: raise HTTPException( status_code=status.HTTP_404_NOT_FOUND, - detail=f"Book with ID {book_id} does not exist" + detail="Book not found" ) - - return book + return book \ No newline at end of file