Skip to content
Closed
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 @@ -327,6 +327,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 @@ -422,11 +435,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(),
)
Comment on lines 441 to 445
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

Consider adding a regression test for this behavior (e.g., calling SolutionVariableInfo.get_variables_info(..., domain_name="bad")) asserting that an invalid domain now raises DomainError (and that the message includes the allowed domain list). This would prevent the prior TypeError regression from reappearing.

Copilot uses AI. Check for mistakes.
Expand Down
Loading