From d9b8bb0ba62d750ab13a1cda5f33bbfcb1f30358 Mon Sep 17 00:00:00 2001 From: imarom Date: Wed, 17 Feb 2016 03:12:52 -0500 Subject: timeout connection error message was broken --- .../stl/trex_stl_lib/trex_stl_jsonrpc_client.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py') diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py index 96d1854d..7b284cb5 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py @@ -150,8 +150,8 @@ class JsonRpcClient(object): else: response = self.send_raw_msg(msg) - if response == None: - return RC_ERR("*** [RPC] - Failed to decode response from server") + if not response: + return response # print after @@ -159,8 +159,10 @@ class JsonRpcClient(object): self.verbose_msg("Server Response:\n\n" + self.pretty_json(response) + "\n") # process response (batch and regular) - - response_json = json.loads(response) + try: + response_json = json.loads(response) + except (TypeError, ValueError): + return RC_ERR("*** [RPC] - Failed to decode response from server") if isinstance(response_json, list): return self.process_batch_response(response_json) -- cgit 1.2.3-korg