-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
REFACTOR: Improve try/except statements in _get_design_mesh_regions
and _get_design_mesh_operations
#4636
Conversation
Thanks for opening a Pull Request. If you want to perform a review write a comment saying: @ansys-reviewer-bot review |
_get_design_mesh_regions
and _get_design_mesh_operations
_get_design_mesh_regions
and _get_design_mesh_operations
_get_design_mesh_regions
and _get_design_mesh_operations
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4636 +/- ##
==========================================
- Coverage 80.84% 80.82% -0.02%
==========================================
Files 119 119
Lines 54531 54537 +6
==========================================
- Hits 44084 44081 -3
- Misses 10447 10456 +9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you able to know why the TypeError is raised ? If not I would rather use self._app.logger.debug("Failed to get design mesh operations")
for every exception.
For the Keyerror handling, I would also use the previous log as it is considered bad practice to use a try: ... except: pass pattern. Tools that we'll use for vulnerability checking would report such things as a vulnerability.
In both cases, the user was previously seeing an error being logged when the code was actually working as intended (empty mesh region/empty mesh operation list) all the time he was accessing the mesh class with a new proj/a project without any region. I can try to rewrite everything from scratch, but I wouldn't leave an error being raised and logged when the code is working properly (and in addition given that the error comes from an internal function) as this could throw off a lot of beginner/intermediate users. |
When I was speaking about the previous log I wanted to refer to the one I did type. Sorry for not being clear enough. What you did is great and the right thing to do. We should just avoid using the try: except: pass pattern. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Close #4632.
Current implementation of
_get_design_mesh_regions
and_get_design_mesh_operations
lead to errors being logged, I removed this improving try/except statements