Skip to content

Commit

Permalink
Handle RoomNotFound error on fork creation
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc authored Dec 18, 2024
1 parent 6f73427 commit 8012a81
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion projects/jupyter-server-ydoc/jupyter_server_ydoc/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,12 @@ async def put(self, root_roomid):
Optionally keeps the fork in sync with the root.
"""
fork_roomid = uuid4().hex
root_room = await self._websocket_server.get_room(root_roomid)
try:
root_room = await self._websocket_server.get_room(root_roomid)
except RoomNotFound:
self.set_status(404)
self.finish({"code": 404, "error": "Room not found"})

update = root_room.ydoc.get_update()
fork_ydoc = Doc()
fork_ydoc.apply_update(update)
Expand Down

0 comments on commit 8012a81

Please sign in to comment.