Skip to content

Commit ed7236c

Browse files
authored
Catch mixer error and re-throw in get_stat_value() (#147)
1 parent 06cf3c2 commit ed7236c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

datacommons/stat_vars.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ def get_stat_value(place,
7676
if scaling_factor:
7777
url += '&scaling_factor={}'.format(scaling_factor)
7878

79-
res_json = utils._send_request(url, post=False, use_payload=False)
80-
81-
if 'value' not in res_json:
82-
raise ValueError('No data in response.')
79+
try:
80+
res_json = utils._send_request(url, post=False, use_payload=False)
81+
except ValueError:
82+
raise ValueError('No data in response.')
8383
return res_json['value']
8484

8585

0 commit comments

Comments
 (0)