Skip to content

Commit 9ae8925

Browse files
Jorge Fernandez HernandezJorge Fernandez Hernandez
authored andcommitted
EUCLIDPCR-1863 Make the error message private
1 parent d756ac0 commit 9ae8925

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

astroquery/esa/euclid/core.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@
2626

2727

2828
class EuclidClass(TapPlus):
29-
ERROR_MSG_REQUESTED_OBSERVATION_ID = "Missing required argument: 'observation_id'"
30-
ERROR_MSG_REQUESTED_TILE_ID = "Missing required argument: 'tile_id'"
31-
ERROR_MSG_REQUESTED_OBSERVATION_ID_AND_TILE_ID = "Incompatible: 'observation_id' and 'tile_id'. Use only one."
32-
ERROR_MSG_REQUESTED_PRODUCT_TYPE = "Missing required argument: 'product_type'"
33-
ERROR_MSG_REQUESTED_GENERIC = "Missing required argument"
34-
ERROR_MSG_REQUESTED_RADIUS = "Radius cannot be greater than 30 arcminutes"
29+
30+
__ERROR_MSG_REQUESTED_OBSERVATION_ID = "Missing required argument: 'observation_id'"
31+
__ERROR_MSG_REQUESTED_TILE_ID = "Missing required argument: 'tile_id'"
32+
__ERROR_MSG_REQUESTED_OBSERVATION_ID_AND_TILE_ID = "Incompatible: 'observation_id' and 'tile_id'. Use only one."
33+
__ERROR_MSG_REQUESTED_PRODUCT_TYPE = "Missing required argument: 'product_type'"
34+
__ERROR_MSG_REQUESTED_GENERIC = "Missing required argument"
35+
__ERROR_MSG_REQUESTED_RADIUS = "Radius cannot be greater than 30 arcminutes"
3536
EUCLID_MESSAGES = "notification?action=GetNotifications"
3637

3738
"""
@@ -672,9 +673,9 @@ def get_observation_products(self, *, id=None, schema="sedm", product_type=None,
672673
"""
673674

674675
if id is None:
675-
raise ValueError(self.ERROR_MSG_REQUESTED_OBSERVATION_ID)
676+
raise ValueError(self.__ERROR_MSG_REQUESTED_OBSERVATION_ID)
676677
if product_type is None:
677-
raise ValueError(self.ERROR_MSG_REQUESTED_PRODUCT_TYPE)
678+
raise ValueError(self.__ERROR_MSG_REQUESTED_PRODUCT_TYPE)
678679
if product_type not in conf.PRODUCT_TYPES:
679680
raise ValueError(f"Invalid product type {product_type}. Valid values: {conf.PRODUCT_TYPES}")
680681

@@ -764,9 +765,9 @@ def __get_tile_catalogue_list(self, *, tile_index, product_type, verbose=False):
764765
"""
765766

766767
if tile_index is None:
767-
raise ValueError(self.ERROR_MSG_REQUESTED_TILE_ID)
768+
raise ValueError(self.__ERROR_MSG_REQUESTED_TILE_ID)
768769
if product_type is None:
769-
raise ValueError(self.ERROR_MSG_REQUESTED_PRODUCT_TYPE)
770+
raise ValueError(self.__ERROR_MSG_REQUESTED_PRODUCT_TYPE)
770771

771772
query = None
772773

@@ -906,13 +907,13 @@ def get_product_list(self, *, observation_id=None, tile_index=None, product_type
906907
The list of products (astropy.table)
907908
"""
908909
if product_type is None:
909-
raise ValueError(self.ERROR_MSG_REQUESTED_PRODUCT_TYPE)
910+
raise ValueError(self.__ERROR_MSG_REQUESTED_PRODUCT_TYPE)
910911

911912
if observation_id is not None and tile_index is not None:
912-
raise ValueError(self.ERROR_MSG_REQUESTED_OBSERVATION_ID_AND_TILE_ID)
913+
raise ValueError(self.__ERROR_MSG_REQUESTED_OBSERVATION_ID_AND_TILE_ID)
913914

914915
if observation_id is None and tile_index is None:
915-
raise ValueError(self.ERROR_MSG_REQUESTED_OBSERVATION_ID + "; " + self.ERROR_MSG_REQUESTED_TILE_ID)
916+
raise ValueError(self.__ERROR_MSG_REQUESTED_OBSERVATION_ID + "; " + self.__ERROR_MSG_REQUESTED_TILE_ID)
916917

917918
if tile_index is not None:
918919
return self.__get_tile_catalogue_list(tile_index=tile_index, product_type=product_type, verbose=verbose)
@@ -1098,12 +1099,12 @@ def get_cutout(self, *, file_path=None, instrument=None, id=None, coordinate, ra
10981099
"""
10991100

11001101
if file_path is None or instrument is None or id is None or coordinate is None or radius is None:
1101-
raise ValueError(self.ERROR_MSG_REQUESTED_GENERIC)
1102+
raise ValueError(self.__ERROR_MSG_REQUESTED_GENERIC)
11021103

11031104
# Parse POS
11041105
radius_deg = Angle(self.__get_quantity_input(radius, "radius")).to_value(u.deg)
11051106
if radius_deg > 0.5:
1106-
raise ValueError(self.ERROR_MSG_REQUESTED_RADIUS)
1107+
raise ValueError(self.__ERROR_MSG_REQUESTED_RADIUS)
11071108
coord = commons.parse_coordinates(coordinate)
11081109
ra_hours, dec = commons.coord_to_radec(coord)
11091110
ra = ra_hours * 15.0 # Converts to degrees
@@ -1159,7 +1160,7 @@ def get_spectrum(self, *, source_id=None, schema='sedm', output_file=None, verbo
11591160
"""
11601161

11611162
if source_id is None or schema is None:
1162-
raise ValueError(self.ERROR_MSG_REQUESTED_GENERIC)
1163+
raise ValueError(self.__ERROR_MSG_REQUESTED_GENERIC)
11631164

11641165
params_dict = {'TAPCLIENT': 'ASTROQUERY', 'RETRIEVAL_TYPE': 'SPECTRA'}
11651166
id_value = """{schema} {source_id}""".format(**{'schema': schema, 'source_id': source_id})

0 commit comments

Comments
 (0)