-
Notifications
You must be signed in to change notification settings - Fork 56
Closed
Description
Investigate PyFluent behaviour to find scenarios where we could catch and rethrow to provide improved error information to users. See this post: https://softwareengineering.stackexchange.com/a/231059.
Note some usage examples where the first example could reraise an exception closer to the user's context:
>>> pf.connect_to_fluent(ip="1.2.3.4", port=5555)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\ANSYSDev\pyfluent\src\ansys\fluent\core\launcher\launcher.py", line 349, in connect_to_fluent
fluent_connection = FluentConnection(
File "C:\ANSYSDev\pyfluent\src\ansys\fluent\core\fluent_connection.py", line 417, in __init__
self.health_check.check_health()
File "C:\ANSYSDev\pyfluent\src\ansys\fluent\core\services\health_check.py", line 62, in check_health
response = self._stub.Check(request, metadata=self._metadata)
File "C:\ANSYSDev\pyfluent\.env-local-2\lib\site-packages\grpc\_interceptor.py", line 277, in __call__
response, ignored_call = self._with_call(
File "C:\ANSYSDev\pyfluent\.env-local-2\lib\site-packages\grpc\_interceptor.py", line 329, in _with_call
call = self._interceptor.intercept_unary_unary(
File "C:\ANSYSDev\pyfluent\src\ansys\fluent\core\services\interceptors.py", line 124, in intercept_unary_unary
return self._intercept_call(continuation, client_call_details, request)
File "C:\ANSYSDev\pyfluent\src\ansys\fluent\core\services\interceptors.py", line 114, in _intercept_call
raise new_ex from None
RuntimeError: failed to connect to all addresses; last error: UNKNOWN: ipv4:1.2.3.4:5555: tcp handshaker shutdown
>>>
>>> pf.connect_to_fluent(ip="1.2.3.4")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\ANSYSDev\pyfluent\src\ansys\fluent\core\launcher\launcher.py", line 348, in connect_to_fluent
ip, port, password = _get_server_info(server_info_file_name, ip, port, password)
File "C:\ANSYSDev\pyfluent\src\ansys\fluent\core\launcher\server_info.py", line 56, in _get_server_info
raise IpPortNotProvided()
ansys.fluent.core.launcher.error_handler.IpPortNotProvided: Provide either 'ip' and 'port' or 'server_info_file_name'.
>>>
>>> pf.connect_to_fluent(port=3333)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\ANSYSDev\pyfluent\src\ansys\fluent\core\launcher\launcher.py", line 348, in connect_to_fluent
ip, port, password = _get_server_info(server_info_file_name, ip, port, password)
File "C:\ANSYSDev\pyfluent\src\ansys\fluent\core\launcher\server_info.py", line 56, in _get_server_info
raise IpPortNotProvided()
ansys.fluent.core.launcher.error_handler.IpPortNotProvided: Provide either 'ip' and 'port' or 'server_info_file_name'.
>>>
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
2025 Q3 Jul - Sep