Skip to content

Commit 14ac5df

Browse files
committed
Merge pull request pandas-dev#8053 from jreback/test_data
TST: catch invalid options data parsing
2 parents 3134a8d + f9ddaf1 commit 14ac5df

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

pandas/io/data.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -735,16 +735,20 @@ def _get_option_data(self, month, year, expiry, name):
735735
raise RemoteDataError("Table location {0} invalid, {1} tables"
736736
" found".format(table_loc, ntables))
737737

738-
option_data = _parse_options_data(tables[table_loc])
739-
option_data['Type'] = name[:-1]
740-
option_data = self._process_data(option_data, name[:-1])
738+
try:
739+
option_data = _parse_options_data(tables[table_loc])
740+
option_data['Type'] = name[:-1]
741+
option_data = self._process_data(option_data, name[:-1])
742+
743+
if month == CUR_MONTH and year == CUR_YEAR:
744+
setattr(self, name, option_data)
741745

742-
if month == CUR_MONTH and year == CUR_YEAR:
746+
name += m1 + str(year)[-2:]
743747
setattr(self, name, option_data)
748+
return option_data
744749

745-
name += m1 + str(year)[-2:]
746-
setattr(self, name, option_data)
747-
return option_data
750+
except (Exception) as e:
751+
raise RemoteDataError("Cannot retrieve Table data {0}".format(str(e)))
748752

749753
def get_call_data(self, month=None, year=None, expiry=None):
750754
"""

0 commit comments

Comments
 (0)