-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom Higher Level Exceptions (#2176)
* Custom Higher Level Exceptions * Remove dunder method overload * Remove exceptions from __init__ * Move excpetions to top * Doc fix * Add docstring * Update tests * Add more exceptions * Add new tests * Add new test execution * field data * test fix * test fix 2 * redesign 1 * redesign 2 * redesign 3 * doc fix * update 1 * update 2 * update 3 * update 4 * update 5 * update 6 * test fix * test fix error_message * correct a typo * Updated error messages * Incorporate TaskObject change * Incorporate TaskObject change 2 * Incorporate TaskObject change 3 * Incorporate TaskObject change 4 * Update test
- Loading branch information
Showing
29 changed files
with
511 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"""Custom common higher level exceptions.""" | ||
|
||
from typing import Any, Optional | ||
|
||
from ansys.fluent.core.solver.error_message import allowed_name_error_message | ||
|
||
|
||
class DisallowedValuesError(ValueError): | ||
"""Provides the error when an argument value is not in allowed values.""" | ||
|
||
def __init__( | ||
self, | ||
context: Optional[Any] = None, | ||
name: Optional[Any] = None, | ||
allowed_values: Optional[Any] = None, | ||
): | ||
super().__init__( | ||
allowed_name_error_message( | ||
context=context, trial_name=name, allowed_values=allowed_values | ||
) | ||
) | ||
|
||
|
||
class InvalidArgument(ValueError): | ||
"""Provides the error when an argument value is inappropriate.""" | ||
|
||
pass | ||
|
||
|
||
class SurfaceSpecificationError(ValueError): | ||
"""Provides the error when both ``surface_ids`` and ``surface_names`` are | ||
provided.""" | ||
|
||
def __init__(self): | ||
super().__init__("Provide either 'surface_ids' or 'surface_names'.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.