From 09529609bc24de75fed62052898de322cb66f42f Mon Sep 17 00:00:00 2001 From: Vitaly Bogdanov Date: Thu, 7 Nov 2024 19:12:48 +0300 Subject: [PATCH] Show grounded atom conversion exceptions if any Previous implementation hides conversion exception thrown from get_object() method. It makes debug difficult. Handle attempts to call get_object() on non-grounded atoms by separate condition. All other errors are thrown to the upper stack frames. --- python/hyperon/atoms.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/hyperon/atoms.py b/python/hyperon/atoms.py index 81ce3ed3b..6594a0c83 100644 --- a/python/hyperon/atoms.py +++ b/python/hyperon/atoms.py @@ -329,9 +329,9 @@ def unwrap_args(atoms): except: raise NoReduceError() continue - try: + if hasattr(a, 'get_object'): args.append(a.get_object().content) - except: + else: # NOTE: # Currently, applying grounded operations to pure atoms is not reduced. # If we want, we can raise an exception, or form an error expression instead,