summaryrefslogtreecommitdiff
path: root/example.py
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2013-09-11 10:37:48 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2013-09-11 16:54:59 +0900
commitb9aaf8e51a074724347d3cfb69b351918bae4b98 (patch)
treea42fc15518000dc876da8d3e1e443608a4e0def9 /example.py
parentb1adb9b986f6f1b1c27cb103efbe7fa6e62ac5ef (diff)
downloadpygerrit-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-xexample.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/example.py b/example.py
index d919857..4a836d1 100755
--- a/example.py
+++ b/example.py
@@ -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