From 0f89672a2e72ef7906da4224d671b7aa3c31a8a5 Mon Sep 17 00:00:00 2001 From: David Brochart Date: Wed, 8 Jan 2025 15:22:47 +0100 Subject: [PATCH] Replace AttributeError with KeyError --- jupyter_ydoc/ybasedoc.py | 6 +++--- jupyter_ydoc/yblob.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jupyter_ydoc/ybasedoc.py b/jupyter_ydoc/ybasedoc.py index a365e2d..18032ac 100644 --- a/jupyter_ydoc/ybasedoc.py +++ b/jupyter_ydoc/ybasedoc.py @@ -121,7 +121,7 @@ def dirty(self) -> bool | None: """ try: return self._ystate.dirty - except AttributeError: + except KeyError: return None @dirty.setter @@ -144,7 +144,7 @@ def hash(self) -> str | None: """ try: return self._ystate.hash - except AttributeError: + except KeyError: return None @hash.setter @@ -167,7 +167,7 @@ def path(self) -> str | None: """ try: return self._ystate.path - except AttributeError: + except KeyError: return None @path.setter diff --git a/jupyter_ydoc/yblob.py b/jupyter_ydoc/yblob.py index a282ec6..890a6bb 100644 --- a/jupyter_ydoc/yblob.py +++ b/jupyter_ydoc/yblob.py @@ -70,7 +70,7 @@ def get(self) -> bytes: """ try: return self._ysource.bytes - except AttributeError: + except KeyError: return b"" def set(self, value: bytes) -> None: