Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Handle both JSONDecodeError and ValueError due to differences in json vs. simplejson #1645

Merged
merged 4 commits into from Aug 2, 2013

Conversation

danielgtaylor
Copy link
Member

This merges in #1633 from @kurin, but makes the following changes:

  1. Catches both JSONDecodeError and ValueError
  2. Adds a new test to verify behavior if either exception is thrown

kurin and others added 2 commits August 1, 2013 13:49
simplejson has JSONDecodeError, but json doesn't.
…irm that both are caught and the expected service exception gets raised.
@@ -291,7 +299,7 @@ def __call__(self, query):
r = requests.get(url, params=params)
try:
data = json.loads(r.content)
except json.JSONDecodeError,e:
except (JSONDecodeError, ValueError), e:
Copy link
Member

Choose a reason for hiding this comment

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

What was the reason for not just catching ValueError?

@toastdriven
Copy link
Contributor

LGTM. 🚢-ing it.

@toastdriven toastdriven merged commit 4407fcb into boto:develop Aug 2, 2013
@danielgtaylor danielgtaylor deleted the json-vs-simplejson branch August 3, 2013 03:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants