Skip to content

Commit

Permalink
Make util.get_ui_jsons give better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-blanchard committed Aug 1, 2017
1 parent 9a07fc6 commit b2a8219
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions streamparse/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,15 @@ def get_ui_jsons(env_name, api_paths):
with ssh_tunnel(env_config, local_port=local_port,
remote_port=remote_ui_port) as (host, local_port):
for api_path in api_paths:
r = requests.get('http://{}:{}{}'.format(host,
local_port,
api_path))
url = 'http://{}:{}{}'.format(host, local_port, api_path)
r = requests.get(url)
data[api_path] = r.json()
error = data[api_path].get('error')
if error:
error_msg = data[api_path].get('errorMessage')
raise RuntimeError('Received bad response from {}: '
'{}\n{}'
.format(url, error, error_msg))
return data
except Exception as e:
if "already in use" in str(e):
Expand Down

0 comments on commit b2a8219

Please sign in to comment.