-
Notifications
You must be signed in to change notification settings - Fork 57
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
Don't throw an exception if API's JSON response lacks an expected key #273
Don't throw an exception if API's JSON response lacks an expected key #273
Conversation
25142d6
to
4433eec
Compare
Codecov Report
@@ Coverage Diff @@
## main #273 +/- ##
=======================================
Coverage 68.24% 68.24%
=======================================
Files 45 45
Lines 3549 3549
Branches 752 752
=======================================
Hits 2422 2422
Misses 801 801
Partials 326 326
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, small fixes to the changelog fragment.
Instead of throwing an exception, be more defensive in the code: if the API's JSON response lacks a key and we correspondingly set a variable to `None`, then don't call `get()` on the variable, but test the variable first. AttributeError: 'NoneType' object has no attribute 'get' Fixes ansible-collections#272.
4433eec
to
5cb930f
Compare
force pushed new commit to address comment(s) about changelog fragment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; thanks!
SUMMARY
Instead of throwing an exception, be more defensive in the code: if
the API's JSON response lacks a key and we correspondingly set a
variable to
None
, then don't callget()
on the variable, but testthe variable first.
Fixes #272.
ISSUE TYPE
COMPONENT NAME
digital_ocean_droplet
ADDITIONAL INFORMATION