Skip to content

Commit b819d3b

Browse files
Update media_manager/movies/repository.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent a603c65 commit b819d3b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

media_manager/movies/repository.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,10 @@ def delete_movie_request(self, movie_request_id: MovieRequestId) -> None:
228228
"""
229229
try:
230230
stmt = delete(MovieRequest).where(MovieRequest.id == movie_request_id)
231-
self.db.execute(stmt)
231+
result = self.db.execute(stmt)
232+
if result.rowcount == 0:
233+
self.db.rollback()
234+
raise NotFoundError(f"movie request with id {movie_request_id} not found.")
232235
self.db.commit()
233236
# Successfully deleted movie request with id: {movie_request_id}
234237
except SQLAlchemyError as e:

0 commit comments

Comments
 (0)