From 24f74e9ee4b9d2d034417adc89928f5f0c2220ed Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 7 Mar 2024 19:10:18 -0800 Subject: [PATCH] Add "raise from" on keyerror. --- voussoirkit/dotdict.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/voussoirkit/dotdict.py b/voussoirkit/dotdict.py index 5351bc8..a5182d2 100644 --- a/voussoirkit/dotdict.py +++ b/voussoirkit/dotdict.py @@ -20,10 +20,10 @@ class DotDict: def __getattr__(self, key): try: return self.__dict__[key] - except KeyError: + except KeyError as exc: if self.__default is not NO_DEFAULT: return self.__default - raise + raise AttributeError from exc def __setattr__(self, key, value): self.__dict__[key] = value