ansys / pyfluent

Pythonic interface to Ansys Fluent
https://fluent.docs.pyansys.com
MIT License
256 stars 41 forks source link

Minor: exception defined inside internal method #2750

Closed raph-luc closed 4 months ago

raph-luc commented 4 months ago

Quick question: https://github.com/ansys/pyfluent/blob/1e1416aa5c9ee706159b58d152eab45a59cee44c/src/ansys/fluent/core/workflow.py#L66-L73

Isn't this definition for a custom Exception nested inside a non-public method kind of useless, in the sense that users won't easily be able to import and catch this NewCommandError? In which case this 5 lines definition could be replaced with just Exception(f"Could not create command for task {task_name}") as it would be caught using except Exception: regardless?

Otherwise I think this custom exception definition should be moved outside of the non-public method, so that it can more easily be imported if an user wants to catch it.

raph-luc commented 4 months ago

As discussed in the meeting earlier today, I will work on this