diff options
author | David Pursehouse <david.pursehouse@sonymobile.com> | 2013-09-11 18:24:12 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2013-09-11 18:25:27 +0900 |
commit | e161a51bbe40ba8550e9bf4a9049fb63cd82e399 (patch) | |
tree | a42af66275ac4260660af85cb5470fab900fa57f /example.py | |
parent | ae73d53259d3639a65e16a6af97c4251a188b663 (diff) | |
download | pygerrit-e161a51bbe40ba8550e9bf4a9049fb63cd82e399.tar.gz |
Allow example script to continue if errors are received
Add an option to ignore error events and continue receiving.
Connection errors are not ignored and will still result in the
script exiting.
Change-Id: I807fa50700eb6970b7fbabe48c499fe513717c4d
Diffstat (limited to 'example.py')
-rwxr-xr-x | example.py | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -52,6 +52,9 @@ def _main(): parser.add_option('-v', '--verbose', dest='verbose', action='store_true', help='enable verbose (debug) logging') + parser.add_option('-i', '--ignore-stream-errors', dest='ignore', + action='store_true', + help='do not exit when an error event is received') (options, _args) = parser.parse_args() if options.timeout and not options.blocking: @@ -77,7 +80,7 @@ def _main(): timeout=options.timeout) if event: logging.info("Event: %s", event) - if isinstance(event, ErrorEvent): + if isinstance(event, ErrorEvent) and not options.ignore: logging.error(event.error) errors.set() break |