Skip to content

Commit

Permalink
refactor: Make flobject consistent with server. (#2362)
Browse files Browse the repository at this point in the history
* Make flobject consistent with server.

* Update docstring.

* Update src/ansys/fluent/core/solver/flobject.py

Co-authored-by: Sean Pearson <[email protected]>

---------

Co-authored-by: Sean Pearson <[email protected]>
  • Loading branch information
prmukherj and seanpearsonuk authored Jan 19, 2024
1 parent 007eb54 commit f4eb9dc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ansys/fluent/core/solver/flobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit f4eb9dc

Please sign in to comment.