Skip to content

Handle bad indices in the json_path #25

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

Merged
merged 2 commits into from
Nov 24, 2020
Merged

Conversation

makermelissa
Copy link
Collaborator

It currently handles bad names, but not indices. This fixes it.

@makermelissa makermelissa requested a review from a team November 24, 2020 22:21
@@ -139,7 +139,7 @@ def json_traverse(json, path):
for x in path:
try:
value = value[x]
except TypeError as error:
except (TypeError, KeyError) as error:
Copy link
Member

Choose a reason for hiding this comment

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

Do you want IndexError as well? I think that would cover lists. KeyError is for dicts I believe.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, I'll add that too.

@makermelissa makermelissa merged commit fed451c into adafruit:main Nov 24, 2020
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Nov 25, 2020
Updating https://github.com/adafruit/Adafruit_CircuitPython_INA260 to 1.2.4 from 1.2.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_INA260#14 from SaintGimp/fix-count-constants

Updating https://github.com/adafruit/Adafruit_CircuitPython_ImageLoad to 0.13.1 from 0.13.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_ImageLoad#42 from FoamyGuy/magtag_example

Updating https://github.com/adafruit/Adafruit_CircuitPython_MagTag to 1.1.1 from 1.0.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_MagTag#25 from makermelissa/main
  > Merge pull request adafruit/Adafruit_CircuitPython_MagTag#26 from adafruit/rename-example
  > Merge pull request adafruit/Adafruit_CircuitPython_MagTag#24 from makermelissa/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_ProgressBar to 1.3.5 from 1.3.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_ProgressBar#19 from FoamyGuy/magtag_example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants