diff --git a/lib/OpenLayers/Format/WMSDescribeLayer/v1_1.js b/lib/OpenLayers/Format/WMSDescribeLayer/v1_1.js index 7d33908c7e..f9298b5310 100644 --- a/lib/OpenLayers/Format/WMSDescribeLayer/v1_1.js +++ b/lib/OpenLayers/Format/WMSDescribeLayer/v1_1.js @@ -90,6 +90,12 @@ OpenLayers.Format.WMSDescribeLayer.v1_1 = OpenLayers.Class( } describelayer.push({layerName: layerName, owsType: owsType, owsURL: owsURL, typeName: typeName}); + } else if (nodeName == 'ServiceException') { + // an exception must have occurred, so parse it + var parser = new OpenLayers.Format.OGCExceptionReport(); + return { + error: parser.read(data) + }; } } return describelayer; diff --git a/tests/Format/WMSDescribeLayer.html b/tests/Format/WMSDescribeLayer.html index f564da350e..ad5860f273 100644 --- a/tests/Format/WMSDescribeLayer.html +++ b/tests/Format/WMSDescribeLayer.html @@ -34,6 +34,18 @@ } + function test_read_exception(t) { + t.plan(1); + var text = '' + + '' + + ' ' + + 'geonode:_map_107_annotations: no such layer on this server' + + ''; + var format = new OpenLayers.Format.WMSDescribeLayer(); + var obj = format.read(text); + t.ok(!!obj.error, "Error reported correctly"); + } +