diff options
author | David Pursehouse <david.pursehouse@sonymobile.com> | 2013-09-11 10:37:48 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2013-09-11 16:54:59 +0900 |
commit | b9aaf8e51a074724347d3cfb69b351918bae4b98 (patch) | |
tree | a42fc15518000dc876da8d3e1e443608a4e0def9 /example.py | |
parent | b1adb9b986f6f1b1c27cb103efbe7fa6e62ac5ef (diff) | |
download | pygerrit-b9aaf8e51a074724347d3cfb69b351918bae4b98.tar.gz |
Fix #5: Move json parsing and error handling into the event factory
Pass the raw string into the event factory and parse it to a json
object there. If the string is not valid json, generate an error
event.
Add a unit test for handling of invalid json on the event stream.
Change-Id: I209a89fd28c3a594b71443fc106e25d58c5cc1ea
Diffstat (limited to 'example.py')
-rwxr-xr-x | example.py | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -33,7 +33,7 @@ import time from pygerrit.client import GerritClient from pygerrit.error import GerritError -from pygerrit.stream import GerritStreamErrorEvent +from pygerrit.events import ErrorEvent def _main(): @@ -77,7 +77,7 @@ def _main(): timeout=options.timeout) if event: logging.info("Event: %s", event) - if isinstance(event, GerritStreamErrorEvent): + if isinstance(event, ErrorEvent): logging.error(event.error) errors.set() break |