Skip to content

Commit

Permalink
v.in.wfs: improve error message for ServiceException (OSGeo#4812)
Browse files Browse the repository at this point in the history
the current one said that the downloaded XML cannot be found - report the meaningful content of service exception report instead
  • Loading branch information
pesekon2 authored Dec 12, 2024
1 parent 3b1d889 commit 60ad5a7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripts/v.in.wfs/v.in.wfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,14 @@ def main():
grass.run_command("v.in.ogr", flags="o", input=tmpxml, output=out)
grass.message(_("Vector map <%s> imported from WFS.") % out)
except Exception:
import xml.etree.ElementTree as ET

grass.message(_("WFS import failed"))

root = ET.parse(tmpxml).getroot()
if "ServiceExceptionReport" in root.tag:
se = root.find(root.tag[:-6]) # strip "Report" from the tag
grass.message(se.text.strip())
finally:
try_remove(tmpxml)

Expand Down

0 comments on commit 60ad5a7

Please sign in to comment.