Skip to content
Snippets Groups Projects
Commit fe258fe1 authored by Colm Talbot's avatar Colm Talbot
Browse files

error raising fix if no connection is available

parent a744f7e6
Branches open_data
No related tags found
No related merge requests found
......@@ -254,14 +254,13 @@ def get_open_strain_data(
logging.info('Using cached data from {}'.format(filename))
strain = TimeSeries.read(filename)
else:
logging.info('Fetching open data ...')
try:
logging.info('Fetching open data ...')
strain = TimeSeries.fetch_open_data(name, t1, t2, **kwargs)
logging.info('Saving data to {}'.format(filename))
strain.write(filename)
except urllib.error.URLError:
logging.warning("Can't fetch data for {}".format(name))
strain = None
raise ValueError("Can't fetch {} data.".format(name))
return strain
......@@ -368,4 +367,4 @@ def process_strain_data(
frequency_domain_strain, frequencies = nfft(strain.value, sampling_frequency)
return frequency_domain_strain, frequencies
\ No newline at end of file
return frequency_domain_strain, frequencies
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment