Skip to content

Commit 7ede5b3

Browse files
#3022 raise EmptyResponseError if no table lines are returned
1 parent 371c152 commit 7ede5b3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

astroquery/mpc/core.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,12 +1061,20 @@ def _parse_result(self, result, **kwargs):
10611061
# find column headings
10621062
if SKY:
10631063
# slurp to newline after "h m s"
1064-
i = text_table.index('\n', text_table.index('h m s')) + 1
1064+
# raise EmptyResponseError if no ephemeris lines are found in the query response
1065+
try:
1066+
i = text_table.index('\n', text_table.index('h m s')) + 1
1067+
except ValueError as e:
1068+
raise EmptyResponseError(content)
10651069
columns = text_table[:i]
10661070
data_start = columns.count('\n') - 1
10671071
else:
10681072
# slurp to newline after "JD_TT"
1069-
i = text_table.index('\n', text_table.index('JD_TT')) + 1
1073+
# raise EmptyResponseError if no ephemeris lines are found in the query response
1074+
try:
1075+
i = text_table.index('\n', text_table.index('JD_TT')) + 1
1076+
except ValueError as e:
1077+
raise EmptyResponseError(content)
10701078
columns = text_table[:i]
10711079
data_start = columns.count('\n') - 1
10721080

0 commit comments

Comments
 (0)