From b73bd6e99de691550f07229fbf1c7a585c737526 Mon Sep 17 00:00:00 2001 From: Gregoo Date: Fri, 24 Jan 2025 10:09:50 +0100 Subject: [PATCH] Fix BrickRecordFields failing on KeyError instead of AttributeError when used with hasattr() --- bricktracker/fields.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bricktracker/fields.py b/bricktracker/fields.py index 37d5a21..fc5100b 100644 --- a/bricktracker/fields.py +++ b/bricktracker/fields.py @@ -4,6 +4,9 @@ from typing import Any # SQLite record fields class BrickRecordFields(object): def __getattr__(self, name: str, /) -> Any: + if name not in self.__dict__: + raise AttributeError(name) + return self.__dict__[name] def __setattr__(self, name: str, value: Any, /) -> None: