Skip to content
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

Protect execution from specific exceptions #2677

Merged
merged 4 commits into from
Jan 22, 2024

Conversation

germa89
Copy link
Collaborator

@germa89 germa89 commented Jan 17, 2024

I created a decorator which will protect execution from specific exceptions.

I think it is cleaner way to avoid exceptions.

The idea was to fix #2676 by wrapping exit with protect_from.. But I feel it might provoke an early exit.
I could just wrap logging.info, logging.debug, etc... since we are calling it from our custom logger class. But adding many try and errors might slow down the code.

@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@github-actions github-actions bot added the BUG label Jan 17, 2024
Copy link

codecov bot commented Jan 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b9aa292) 84.98% compared to head (dd3c4dd) 82.31%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2677      +/-   ##
==========================================
- Coverage   84.98%   82.31%   -2.68%     
==========================================
  Files          47       47              
  Lines        9308     9322      +14     
==========================================
- Hits         7910     7673     -237     
- Misses       1398     1649     +251     

@germa89 germa89 enabled auto-merge (squash) January 17, 2024 11:43
@germa89 germa89 requested review from clatapie, a team and pyansys-ci-bot and removed request for a team January 17, 2024 11:43
@germa89 germa89 self-assigned this Jan 17, 2024
@germa89
Copy link
Collaborator Author

germa89 commented Jan 17, 2024

I think this PR has value... so I'm keeping it.. but I might think something different for the mapdl.exit.

@germa89 germa89 disabled auto-merge January 17, 2024 12:01
Copy link
Contributor

@clatapie clatapie left a comment

Choose a reason for hiding this comment

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

LGTM!

@germa89 germa89 enabled auto-merge (squash) January 22, 2024 14:20
@germa89 germa89 merged commit 20c4c73 into main Jan 22, 2024
28 checks passed
@germa89 germa89 deleted the fix/avoiding-logging-on-a-closed-file branch January 22, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logger attemp to write on a closed file while exiting
2 participants