From f4eb9dc89a9a9181c36160ee1a72842776f4858b Mon Sep 17 00:00:00 2001 From: Prithwish Mukherjee <109645853+prmukherj@users.noreply.github.com> Date: Sat, 20 Jan 2024 00:09:54 +0530 Subject: [PATCH] refactor: Make flobject consistent with server. (#2362) * Make flobject consistent with server. * Update docstring. * Update src/ansys/fluent/core/solver/flobject.py Co-authored-by: Sean Pearson <93727996+seanpearsonuk@users.noreply.github.com> --------- Co-authored-by: Sean Pearson <93727996+seanpearsonuk@users.noreply.github.com> --- src/ansys/fluent/core/solver/flobject.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ansys/fluent/core/solver/flobject.py b/src/ansys/fluent/core/solver/flobject.py index 68dd046761f..98f04bcb84d 100644 --- a/src/ansys/fluent/core/solver/flobject.py +++ b/src/ansys/fluent/core/solver/flobject.py @@ -33,10 +33,10 @@ class InactiveObjectError(RuntimeError): - """Provides the error when the object is inactive.""" + """Inactive object access.""" - def __init__(self): - super().__init__("Object is not active.") + def __init__(self, python_path): + super().__init__(f"'{python_path}' is currently inactive.") class _InlineConstants: @@ -216,7 +216,7 @@ def get_attr( if attrs: attrs = attrs.get("attrs", attrs) if attr != "active?" and attrs and attrs.get("active?", True) is False: - raise InactiveObjectError() + raise InactiveObjectError(self.python_path) val = None if attrs: val = attrs[attr] @@ -581,7 +581,7 @@ def _get_parent_of_active_child_names(self, name): def __getattribute__(self, name): if name in super().__getattribute__("child_names"): if self.is_active() is False: - raise RuntimeError(f"'{self.python_path}' is currently not active") + raise InactiveObjectError(self.python_path) try: return super().__getattribute__(name) except AttributeError as ex: