|
7 | 7 | """
|
8 | 8 |
|
9 | 9 | import difflib
|
| 10 | +from json import JSONDecodeError |
10 | 11 | import warnings
|
11 | 12 |
|
12 | 13 | from astropy.table import Table
|
13 | 14 | import astropy.units as u
|
14 | 15 | import astropy.coordinates as coord
|
| 16 | +from requests import RequestException |
15 | 17 |
|
16 | 18 | from astroquery.utils import commons, async_to_sync
|
17 | 19 | from astroquery.utils.class_or_instance import class_or_instance
|
@@ -292,8 +294,18 @@ def get_column_list(self):
|
292 | 294 | # Create Table with parsed data
|
293 | 295 | col_table = Table(rows=rows, names=('name', 'data_type', 'description'))
|
294 | 296 | self.columns[self.mission] = col_table
|
| 297 | + except JSONDecodeError as ex: |
| 298 | + raise JSONDecodeError(f'Failed to decode JSON response while attempting to get column list' |
| 299 | + f' for mission {self.mission}: {ex}') |
| 300 | + except RequestException as ex: |
| 301 | + raise ConnectionError(f'Failed to connect to the server while attempting to get column list' |
| 302 | + f' for mission {self.mission}: {ex}') |
| 303 | + except KeyError as ex: |
| 304 | + raise KeyError(f'Expected key not found in response data while attempting to get column list' |
| 305 | + f' for mission {self.mission}: {ex}') |
295 | 306 | except Exception as ex:
|
296 |
| - raise RuntimeError(f'Error occurred while trying to get column list for mission {self.mission}: {ex}') |
| 307 | + raise RuntimeError(f'An unexpected error occurred while attempting to get column list' |
| 308 | + f' for mission {self.mission}: {ex}') |
297 | 309 |
|
298 | 310 | return self.columns[self.mission]
|
299 | 311 |
|
|
0 commit comments