Fix OrTerminationCondition to raise TerminatedException instead of RuntimeError#7188
Open
Nepomuk5665 wants to merge 1 commit intomicrosoft:mainfrom
Open
Fix OrTerminationCondition to raise TerminatedException instead of RuntimeError#7188Nepomuk5665 wants to merge 1 commit intomicrosoft:mainfrom
Nepomuk5665 wants to merge 1 commit intomicrosoft:mainfrom
Conversation
…ntimeError OrTerminationCondition was raising RuntimeError when called after termination, while AndTerminationCondition and all other termination conditions raise TerminatedException for consistency. This fix makes the exception type consistent across all termination condition implementations. Also standardized the error message format by removing the trailing period from AndTerminationCondition to match the convention used everywhere else.
71bd5c5 to
1f4c284
Compare
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.
Summary
OrTerminationConditionto raiseTerminatedExceptioninstead ofRuntimeErrorwhen the termination condition has already been reachedAndTerminationConditionProblem
OrTerminationCondition.__call__was raisingRuntimeErrorwhen called after the condition was already terminated:However,
AndTerminationConditionand all other termination conditions in_terminations.pyraiseTerminatedException:Solution
OrTerminationConditionto raiseTerminatedExceptioninstead ofRuntimeErrorAndTerminationConditionerror message to match the convention used in all other termination conditionsThis ensures consistent exception handling across all termination condition implementations.
Testing
The existing test
test_or_terminationpasses. The fix alignsOrTerminationConditionwith the expected behavior documented inTerminationCondition.__call__docstring which states: