From da80dd3cf485452082541e00cc11c57b6ebe3f65 Mon Sep 17 00:00:00 2001 From: Alexey Baran Date: Thu, 29 Aug 2024 12:53:28 -0300 Subject: [PATCH] fix AttributeError doesn't mention the attribute #151 --- modelx/core/space.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modelx/core/space.py b/modelx/core/space.py index 08a518c..73a8267 100644 --- a/modelx/core/space.py +++ b/modelx/core/space.py @@ -306,7 +306,8 @@ def __getattr__(self, name): if name in self._impl.namespace: return self._impl.get_attr(name) else: - raise AttributeError # Must return AttributeError for hasattr + raise AttributeError(f"Attribute '{name}' is not in space {str(self)}") + # Must return AttributeError for hasattr def __dir__(self): return list(self._impl.namespace.interfaces)