Fix Custom Excepthook#157
Open
mxkpp wants to merge 5 commits into
Open
Conversation
…er than replace existing custom hook with raw sys.__excepthook__ call plus new behavior.
Author
|
@idtodd if you could please review this, I would like to push one more improvement to the err_handler.py type-checking before we merge though. |
…o function err_handler.err_out_screen or err_handler.err_out_screen_para
Author
I've added the improved type checking on the error message handling. I believe this is ready to merge afte review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixed 2 issues with the custom excepthook, which is one of the exit-handling methods applied to ensure certain "cleanup" behavior in various exit situations:
sys.excepthookassignment was typedsys.exepthook, so the excepthook was not actually being overridden with a custom method. This typo was masked by how the forcing engine's own err handler was catching exceptions itself and callingsys.exit(1)(triggering the same intended cleanup routine, but for a different exit condition) before the exception bubbled up to the actual Python system excepthook. This typo has been fixed.sys.__excepthook__before calling its custom behavior. The intent here was to perform regular excepthook behavior before the cleanup. However as @idtodd pointed out, this means that if other parts of the program had already reassignedsys.excepthookto a custom callable, then that would not be honored. Instead, this PR changes the forcing engine's custom excepthook to save a copy ofsys.excepthook(rather thansys.__excepthook__) to be called later before adding its cleanup steps to the final hook. This essentially extends any existing custom excepthook behavior.err_handler.err_out_screenanderr_handler.err_out_screen_parato handle cases of aNonemessage being passed as theerr_msgargument.Additions
Removals
Changes
Testing
Screenshots
Notes
Todos
Checklist
Testing checklist
Target Environment support