From 511cc4c03449d58b42d59349363c766c60d48451 Mon Sep 17 00:00:00 2001 From: sursh Date: Mon, 8 Apr 2013 13:00:27 -0300 Subject: [PATCH 1/3] Make json error on empty response more specific --- docs/user/quickstart.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/user/quickstart.rst b/docs/user/quickstart.rst index 8ec9030c..7264fd56 100644 --- a/docs/user/quickstart.rst +++ b/docs/user/quickstart.rst @@ -131,7 +131,8 @@ There's also a builtin JSON decoder, in case you're dealing with JSON data:: >>> r.json() [{u'repository': {u'open_issues': 0, u'url': 'https://github.com/... -In case the JSON decoding fails, ``r.json`` raises an exception. +In case the JSON decoding fails, ``r.json`` raises an exception: `ValueError: +No JSON object could be decoded` Raw Response Content From dfa59c2d97485ef018939ff85a7d1b957719df70 Mon Sep 17 00:00:00 2001 From: sursh Date: Mon, 8 Apr 2013 13:01:02 -0300 Subject: [PATCH 2/3] Fix markdown --- docs/user/quickstart.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/user/quickstart.rst b/docs/user/quickstart.rst index 7264fd56..d046640e 100644 --- a/docs/user/quickstart.rst +++ b/docs/user/quickstart.rst @@ -131,8 +131,8 @@ There's also a builtin JSON decoder, in case you're dealing with JSON data:: >>> r.json() [{u'repository': {u'open_issues': 0, u'url': 'https://github.com/... -In case the JSON decoding fails, ``r.json`` raises an exception: `ValueError: -No JSON object could be decoded` +In case the JSON decoding fails, ``r.json`` raises an exception: ``ValueError: +No JSON object could be decoded`` Raw Response Content From 8ebeb3dc3fa82bf9d670af2b54a23d9a0b161e35 Mon Sep 17 00:00:00 2001 From: Sasha Laundy Date: Mon, 8 Apr 2013 13:03:13 -0400 Subject: [PATCH 3/3] Make json error message more specific --- docs/user/quickstart.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/user/quickstart.rst b/docs/user/quickstart.rst index d046640e..cb4ef579 100644 --- a/docs/user/quickstart.rst +++ b/docs/user/quickstart.rst @@ -131,7 +131,8 @@ There's also a builtin JSON decoder, in case you're dealing with JSON data:: >>> r.json() [{u'repository': {u'open_issues': 0, u'url': 'https://github.com/... -In case the JSON decoding fails, ``r.json`` raises an exception: ``ValueError: +In case the JSON decoding fails, ``r.json`` raises an exception. For example, if +the response gets a 401 (Unauthorized), attempting ``r.json`` raises ``ValueError: No JSON object could be decoded``