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

Refactor function handler #4463

Merged
merged 9 commits into from
Apr 5, 2024
Merged

Refactor function handler #4463

merged 9 commits into from
Apr 5, 2024

Conversation

maxcapodi78
Copy link
Collaborator

No description provided.

maxcapodi78 added 6 commits April 4, 2024 15:54
 - Failed method raise exception
 - Failed method release the desktop
 - Failed method raise exception
 - Failed method release the desktop
# Conflicts:
#	pyaedt/generic/general_methods.py
@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 maintenance Package and maintenance related testing labels Apr 5, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 5, 2024

Codecov Report

Attention: Patch coverage is 65.85366% with 14 lines in your changes are missing coverage. Please review.

Project coverage is 76.39%. Comparing base (b14315e) to head (b7d2f29).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4463      +/-   ##
==========================================
- Coverage   81.45%   76.39%   -5.06%     
==========================================
  Files         109      109              
  Lines       53538    53553      +15     
==========================================
- Hits        43607    40910    -2697     
- Misses       9931    12643    +2712     

Copy link
Collaborator

@SMoraisAnsys SMoraisAnsys left a comment

Choose a reason for hiding this comment

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

Since the line of codes

            if not settings.enable_error_handler:
                if settings.release_on_exception:
                    from pyaedt.generic.desktop_sessions import _desktop_sessions

                    for v in list(_desktop_sessions.values())[:]:
                        v.release_desktop(v.launched_by_pyaedt, v.launched_by_pyaedt)
                raise e
            else:
                return False

are used in every exception handling, could we have an inner function in wrapper to refactor that and call it every time it is needed ?

@maxcapodi78
Copy link
Collaborator Author

Since the line of codes

            if not settings.enable_error_handler:
                if settings.release_on_exception:
                    from pyaedt.generic.desktop_sessions import _desktop_sessions

                    for v in list(_desktop_sessions.values())[:]:
                        v.release_desktop(v.launched_by_pyaedt, v.launched_by_pyaedt)
                raise e
            else:
                return False

are used in every exception handling, could we have an inner function in wrapper to refactor that and call it every time it is needed ?

Implemented

@maxcapodi78 maxcapodi78 requested a review from SMoraisAnsys April 5, 2024 10:39
SMoraisAnsys
SMoraisAnsys previously approved these changes Apr 5, 2024
Copy link
Collaborator

@SMoraisAnsys SMoraisAnsys left a comment

Choose a reason for hiding this comment

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

LGTM

# Conflicts:
#	pyaedt/desktop.py
@maxcapodi78 maxcapodi78 merged commit 9417af3 into main Apr 5, 2024
15 checks passed
@maxcapodi78 maxcapodi78 deleted the refactor_function_handler branch April 5, 2024 13:11
SMoraisAnsys added a commit that referenced this pull request May 21, 2024
Following my request changes in #4463, it seems that the
pyaedt_function_handler function was not working correctly.
Indeed, if an exception was raised and the settings were such
that one would want the function handler to return False,
no value was returned by the function (leading to a None return).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Package and maintenance related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants