Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/ansys/fluent/core/services/solution_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,19 @@ def __init__(self, zone_name: str, allowed_values: List[str]):
)


class DomainError(ValueError):
"""Exception class for errors in Domain name."""

def __init__(self, domain_name: str, allowed_values: List[str]):
"""Initialize DomainError."""
self.domain_name = domain_name
super().__init__(
allowed_name_error_message(
context="domain", trial_name=domain_name, allowed_values=allowed_values
)
)


class _AllowedNames:
def is_valid(self, name):
"""Check whether a given name is valid or not."""
Expand Down Expand Up @@ -426,11 +439,11 @@ def valid_name(self, domain_name):

Raises
------
ZoneError
DomainError
If the given domain name is invalid.
"""
if not self.is_valid(domain_name):
raise ZoneError(
raise DomainError(
domain_name=domain_name,
allowed_values=self(),
)
Expand Down
1 change: 1 addition & 0 deletions src/ansys/fluent/core/services/solution_variables_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

InvalidSolutionVariableNameError = _v0.InvalidSolutionVariableNameError
ZoneError = _v0.ZoneError
DomainError = _v0.DomainError

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will cherry-pick this and add test case for this as well and create another PR once we have enough approvals.

_AllowedNames = _v0._AllowedNames
_AllowedSvarNames = _v0._AllowedSvarNames
_AllowedZoneNames = _v0._AllowedZoneNames
Expand Down