From 65433ed7ad204f13beb2b0193499760134fed794 Mon Sep 17 00:00:00 2001 From: Paul van Genuchten Date: Thu, 4 Apr 2024 20:56:05 +0200 Subject: [PATCH] resolves issue #916 --- owslib/catalogue/csw2.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/owslib/catalogue/csw2.py b/owslib/catalogue/csw2.py index 193d831e..9567c60a 100644 --- a/owslib/catalogue/csw2.py +++ b/owslib/catalogue/csw2.py @@ -172,22 +172,25 @@ def getdomain(self, dname, dtype='parameter'): self.request = node0 - self._invoke() + try: + self._invoke() - if self.exceptionreport is None: - self.results = {} + if self.exceptionreport is None: + self.results = {} - val = self._exml.find(util.nspath_eval('csw:DomainValues', namespaces)).attrib.get('type') - self.results['type'] = util.testXMLValue(val, True) + val = self._exml.find(util.nspath_eval('csw:DomainValues', namespaces)).attrib.get('type') + self.results['type'] = util.testXMLValue(val, True) - val = self._exml.find(util.nspath_eval('csw:DomainValues/csw:%s' % dtypename, namespaces)) - self.results[dtype] = util.testXMLValue(val) + val = self._exml.find(util.nspath_eval('csw:DomainValues/csw:%s' % dtypename, namespaces)) + self.results[dtype] = util.testXMLValue(val) - # get the list of values associated with the Domain - self.results['values'] = [] + # get the list of values associated with the Domain + self.results['values'] = [] - for f in self._exml.findall(util.nspath_eval('csw:DomainValues/csw:ListOfValues/csw:Value', namespaces)): - self.results['values'].append(util.testXMLValue(f)) + for f in self._exml.findall(util.nspath_eval('csw:DomainValues/csw:ListOfValues/csw:Value', namespaces)): + self.results['values'].append(util.testXMLValue(f)) + except Exception: + self.results['values'] = [] def getrecords(self, qtype=None, keywords=[], typenames='csw:Record', propertyname='csw:AnyText', bbox=None, esn='summary', sortby=None, outputschema=namespaces['csw'], format=outputformat, startposition=0, @@ -715,7 +718,7 @@ def _invoke(self): ] if self._exml.getroot().tag not in valid_xpaths: - raise RuntimeError('Document is XML, but not CSW-ish') + raise RuntimeError(f'Document is XML, but not CSW-ish, {request_url}?{self.request}') # check if it's an OGC Exception val = self._exml.find(util.nspath_eval('ows:Exception', namespaces))