Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#3212 closed defect (fixed)

r.in.wms crashes if server does not exist

Reported by: neteler Owned by: grass-dev@…
Priority: normal Milestone: 7.2.0
Component: Raster Version: svn-releasebranch72
Keywords: r.in.wms Cc:
CPU: Unspecified Platform: Unspecified

Description

Since free WMS services come and go, the script should not crash if a OWS server does not exist (likely "easy" to try/except):

Here a test case:

nslookup bla.bla/ms
...
** server can't find bla.bla/ms: NXDOMAIN

# using script with non-existing WMS server:
r.in.wms -c url="http://bla.bla/ms"
Traceback (most recent call last):
  File "/home/mundialis/software/grass72_svn/dist.x86_64-pc-linux-gnu/scripts/r.in.wms", line 236, in <module>
    sys.exit(main())
  File "/home/mundialis/software/grass72_svn/dist.x86_64-pc-linux-gnu/scripts/r.in.wms", line 218, in main
    wms.GetCapabilities(options)
  File "/home/mundialis/software/grass72_svn/dist.x86_64-pc-linux-gnu/etc/r.in.wms/wms_base.py", line 275, in GetCapabilities
    cap = self._fetchCapabilities(options)
  File "/home/mundialis/software/grass72_svn/dist.x86_64-pc-linux-gnu/etc/r.in.wms/wms_base.py", line 252, in _fetchCapabilities
    msg += _("\nReason: ") + e.reason
TypeError: cannot concatenate 'str' and 'gaierror' objects

A "Server not found" message would be appreciated in such case.

Change History (4)

comment:1 by martinl, 8 years ago

In 69848:

r.in.wms crashes if server does not exist (see #3212)

comment:2 by martinl, 8 years ago

In 69849:

r.in.wms crashes if server does not exist (relbr72 merge 69848 from trunk, see #3212)

comment:3 by martinl, 8 years ago

Resolution: fixed
Status: newclosed

In 69850:

r.in.wms crashes if server does not exist (relbr72 merge 69848 from trunk, fix #3212)

comment:4 by martinl, 8 years ago

Fixed in all active branches, r.in.wms reports

ERROR: Unable to fetch capabilities from <http://bla.bla/ms>. Reason: [Errno -2] Name or service not known
Note: See TracTickets for help on using tickets.