66from io import BytesIO
77
88from astropy .table import QTable , MaskedColumn
9- from astropy .io import ascii
109from astropy .time import Time
1110from astropy .io .votable import parse
1211import astropy .units as u
1312from astropy .coordinates import SkyCoord , Angle
13+ from astropy .utils .exceptions import AstropyUserWarning
14+
15+ from astroquery .exceptions import NoResultsWarning
16+ from astroquery .query import BaseQuery
17+ from astroquery .utils import async_to_sync , commons
1418
15- from ..query import BaseQuery
16- from ..utils import async_to_sync , commons
1719from . import conf
1820
1921__all__ = ['Miriade' , 'MiriadeClass' , 'Skybot' , 'SkybotClass' ]
@@ -611,6 +613,8 @@ def cone_search_async(self,
611613 params = request_payload ,
612614 timeout = TIMEOUT , cache = cache )
613615
616+ response .raise_for_status ()
617+
614618 self ._uri = response .url
615619
616620 return response
@@ -622,14 +626,17 @@ def _parse_result(self, response, *, verbose=False):
622626
623627 if self ._get_raw_response :
624628 return response .text
625- import warnings
626- from astropy .utils .exceptions import AstropyUserWarning
629+
627630 with warnings .catch_warnings ():
628631 # We deal with RA/DEC manually
629632 warnings .filterwarnings ("ignore" , category = AstropyUserWarning ,
630633 message = r"column ra|(column de) has a unit but is kept as a MaskedColumn" )
631634 results = QTable .read (BytesIO (response .content ), format = 'votable' )
632635
636+ if len (results ) == 0 :
637+ warnings .warn ("No objects were found with the query constraints." , NoResultsWarning )
638+ return results
639+
633640 # convert coordinates to degrees
634641 coo = SkyCoord (ra = results ['ra' ], dec = results ['de' ],
635642 unit = (u .hourangle , u .deg ), frame = 'icrs' )
0 commit comments