ソースを参照

r.in.wms crashes if server does not exist (relbr72 merge 69848 from trunk, fix https://trac.osgeo.org/grass/ticket/3212)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@69850 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 8 年 前
コミット
82a12c8d4e
1 ファイル変更6 行追加3 行削除
  1. 6 3
      scripts/r.in.wms/wms_base.py

+ 6 - 3
scripts/r.in.wms/wms_base.py

@@ -6,7 +6,7 @@ List of classes:
  - wms_base::GRASSImporter
  - wms_base::WMSDriversInfo
 
-(C) 2012-2013 by the GRASS Development Team
+(C) 2012-2016 by the GRASS Development Team
 
 This program is free software under the GNU General Public License
 (>=v2). Read the file COPYING that comes with GRASS for details.
@@ -225,10 +225,13 @@ class WMSBase:
             if urllib2.HTTPError == type(e) and e.code == 401:
                 grass.fatal(_("Authorization failed to <%s> when fetching capabilities") % options['url'])
             else:
-                msg = _("Unable to fetch capabilities from <%s>: %s") % (options['url'], e)
+                msg = _("Unable to fetch capabilities from <{}>. Reason: ").format(
+                    options['url'])
                 
                 if hasattr(e, 'reason'):
-                    msg += _("\nReason: ") + e.reason
+                    msg += '{}'.format(e.reason)
+                else:
+                    msg += '{}'.format(e)
                 
                 grass.fatal(msg)