From eb6ecc9a25cba6833a0ced0fea1e9e7dac2808c8 Mon Sep 17 00:00:00 2001 From: Theodore Chang <theodore.chang@physik.hu-berlin.de> Date: Fri, 1 Nov 2024 20:04:19 +0000 Subject: [PATCH] Better error message when the property is not found --- nomad/metainfo/metainfo.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nomad/metainfo/metainfo.py b/nomad/metainfo/metainfo.py index 95d0c467b3..002149caff 100644 --- a/nomad/metainfo/metainfo.py +++ b/nomad/metainfo/metainfo.py @@ -1523,7 +1523,10 @@ class MSection(metaclass=MObjectMeta): try: definition = self._ensure_definition(def_or_name, hint=hint) except (ValueError, MetainfoError): - return False + raise MetainfoError( + f'{def_or_name} is not found in the definition of {self},' + ' are you calling this method on the correct object?' + ) # derived quantity is always set if isinstance(definition, Quantity) and definition.derived is not None: -- GitLab