diff options
author | selias <samelias@cisco.com> | 2017-11-08 14:42:09 +0100 |
---|---|---|
committer | Tibor Frank <tifrank@cisco.com> | 2017-11-08 14:30:26 +0000 |
commit | e42607547e8b23692957f4ff9383291fab2a84ac (patch) | |
tree | 1414d942f1735c52aff290f5ab80879daeac6a40 /resources/libraries/python | |
parent | 849e7756a138ff0b52767cb3cfea7aec9941ee91 (diff) |
HC Test: exception handling for restconf GET operation
When response to GET is 404, json loads() may fail with ValueError.
Change-Id: If627574bb7909a105d13381a2b89445f527ccb7b
Signed-off-by: selias <samelias@cisco.com>
Diffstat (limited to 'resources/libraries/python')
-rw-r--r-- | resources/libraries/python/honeycomb/HoneycombUtil.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/resources/libraries/python/honeycomb/HoneycombUtil.py b/resources/libraries/python/honeycomb/HoneycombUtil.py index b7338d3ed8..76bb5b3878 100644 --- a/resources/libraries/python/honeycomb/HoneycombUtil.py +++ b/resources/libraries/python/honeycomb/HoneycombUtil.py @@ -302,7 +302,14 @@ class HoneycombUtil(object): base_path = HoneycombUtil.read_path_from_url_file(url_file) path = base_path + path status_code, resp = HTTPRequest.get(node, path) - return status_code, loads(resp) + + try: + data = loads(resp) + except ValueError: + logger.debug("Failed to deserialize JSON data.") + data = None + + return status_code, data @staticmethod def put_honeycomb_data(node, url_file, data, path="", |