diff options
| author | David Pursehouse <david.pursehouse@sonymobile.com> | 2012-10-23 20:54:33 +0900 |
|---|---|---|
| committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2012-10-24 10:22:07 +0900 |
| commit | d51d0b8e7e8d01892ac45ad84142bfb42520e341 (patch) | |
| tree | 56006b088d480ab66483ed93c3b21d78826d6085 /pygerrit/client.py | |
| parent | c8ad56f37edb69f46fdc1e3cecc14a760f34f0a1 (diff) | |
| download | pygerrit-d51d0b8e7e8d01892ac45ad84142bfb42520e341.tar.gz | |
Handle JSON errors in query results
Change-Id: Iadced9142673f1a5f277462bc6d9027db4a53e2d
Diffstat (limited to 'pygerrit/client.py')
| -rw-r--r-- | pygerrit/client.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pygerrit/client.py b/pygerrit/client.py index 5ab3950..976681e 100644 --- a/pygerrit/client.py +++ b/pygerrit/client.py @@ -72,7 +72,10 @@ class GerritClient(object): # According to http://goo.gl/h13HD it should be safe to use the # presence of the "type" key to determine whether the dictionary # represents a change or if it's the query status indicator. - data = decoder.decode(line) + try: + data = decoder.decode(line) + except ValueError, err: + raise GerritError("Query returned invalid data: %s", err) if "type" in data: if data["type"] == "error": raise GerritError("Query error: %s" % data["message"]) |
