@@ -315,7 +315,6 @@ def _parse_result(self, response, *, verbose=False):
315315 result ['ELO' ].unit = u .cm ** (- 1 )
316316 except ValueError as ex :
317317 # Give users a more helpful exception when parsing fails
318- original_message = str (ex )
319318 new_message = ("Failed to parse CDMS response. This may be caused by a malformed search return. "
320319 "You can check this by running `CDMS.get_molecule('<id>')` instead; if it works, the "
321320 "problem is caused by the CDMS search interface and cannot be worked around." )
@@ -421,14 +420,33 @@ def tryfloat(x):
421420 def get_molecule (self , molecule_id , * , cache = True , return_response = False ):
422421 """
423422 Retrieve the whole molecule table for a given molecule id
423+
424+ Parameters
425+ ----------
426+ molecule_id : str
427+ The 6-digit molecule identifier as a string
428+ cache : bool
429+ Defaults to True. If set overrides global caching behavior.
430+ See :ref:`caching documentation <astroquery_cache>`.
431+ return_response : bool, optional
432+ If True, return the raw `requests.Response` object instead of parsing
433+ the response. If this is set, the response will be returned whether
434+ or not it was successful. Default is False.
424435 """
425436 if not isinstance (molecule_id , str ) or len (molecule_id ) != 6 :
426437 raise ValueError ("molecule_id should be a length-6 string of numbers" )
427438 url = f'{ self .CLASSIC_URL } /entries/c{ molecule_id } .cat'
428439 response = self ._request (method = 'GET' , url = url ,
429440 timeout = self .TIMEOUT , cache = cache )
441+
430442 if return_response :
431443 return response
444+
445+ response .raise_for_status ()
446+
447+ if 'Zero lines were found' in response .text :
448+ raise EmptyResponseError (f"Response was empty; message was '{ text } '." )
449+
432450 result = self ._parse_cat (response .text )
433451
434452 species_table = self .get_species_table ()
@@ -443,11 +461,6 @@ def _parse_cat(self, text, *, verbose=False):
443461 See details in _parse_response; this is a very similar function,
444462 but the catalog responses have a slightly different format.
445463 """
446-
447- if 'Zero lines were found' in text :
448- raise EmptyResponseError (f"Response was empty; message was '{ text } '." )
449-
450-
451464 # notes about the format
452465 # [F13.4, 2F8.4, I2, F10.4, I3, I7, I4, 12I2]: FREQ, ERR, LGINT, DR, ELO, GUP, TAG, QNFMT, QN noqa
453466 # 13 21 29 31 41 44 51 55 57 59 61 63 65 67 69 71 73 75 77 79 noqa
@@ -516,7 +529,9 @@ def _parse_cat(self, text, *, verbose=False):
516529
517530def parse_letternumber (st ):
518531 """
519- Parse CDMS's two-letter QNs
532+ Parse CDMS's two-letter QNs into integers.
533+
534+ Masked values are converted to -999999.
520535
521536 From the CDMS docs:
522537 "Exactly two characters are available for each quantum number. Therefore, half
0 commit comments