Repository navigation
Conversation
In the second error handler of create_group.py the except clause binds `serverError`, but the re-raise uses `rError`, the name bound by the first handler further up. Python deletes the exception name when the except block ends, so `rError` is not defined there: every API error other than 409011 surfaced as NameError instead of the server message. Verified with pyflakes: undefined name 'rError' gone, no new undefined name. Signed-off-by: Henrique Godoy <95002561+herniqeu@users.noreply.github.com>
|
Thanks for the contribution! Before we can merge this, we need @herniqeu to sign the Salesforce Inc. Contributor License Agreement. |
This branch has not been deployed
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.
Problem
create_group.pyhas two handlers. The second one binds the exception asserverError:rErroris the name bound by the first handler, earlier in the function. Python deletes the exception name at the end of anexceptblock, so at this pointrErrordoes not exist and every failure other than 409011 becomes:which is precisely the diagnostic the sample should be printing.
Fix
raise serverError— re-raise the error actually caught here. The first handler keepsraise rError(valid: it is inside its own except block).Verification
python3 -m pyflakes samples/create_group.pyundefined name 'rError'(line 83)Achado com analise estatica (pyflakes) e leitura do chamador; verificado antes/depois do patch. Commit com
Signed-off-by.