diff --git a/lib/cartodb/models/aggregation/aggregation-mapconfig.js b/lib/cartodb/models/aggregation/aggregation-mapconfig.js index 44a7d408..a22e8316 100644 --- a/lib/cartodb/models/aggregation/aggregation-mapconfig.js +++ b/lib/cartodb/models/aggregation/aggregation-mapconfig.js @@ -117,5 +117,4 @@ module.exports = class AggregationMapConfig extends MapConfig { return featureCount >= threshold; } - }; diff --git a/lib/cartodb/models/mapconfig/adapter/aggregation-mapconfig-adapter.js b/lib/cartodb/models/mapconfig/adapter/aggregation-mapconfig-adapter.js index 1bc13abb..1c3466d7 100644 --- a/lib/cartodb/models/mapconfig/adapter/aggregation-mapconfig-adapter.js +++ b/lib/cartodb/models/mapconfig/adapter/aggregation-mapconfig-adapter.js @@ -117,9 +117,17 @@ module.exports = class AggregationMapConfigAdapter { const result = res.rows[0] || {}; if (!AggregationMapConfig.supportsGeometryType(result.type)) { - return callback(new Error(unsupportedGeometryTypeErrorMessage({ + const error = new Error(unsupportedGeometryTypeErrorMessage({ geometryType: result.type - }))); + })); + error.type = 'layer'; + error.layer = { + id: mapConfig.getLayerId(index), + index: index, + type: mapConfig.layerType(index) + }; + + return callback(error); } if (!mapConfig.doesLayerReachThreshold(index, result.count)) { diff --git a/test/acceptance/aggregation.js b/test/acceptance/aggregation.js index 42990434..074d773e 100644 --- a/test/acceptance/aggregation.js +++ b/test/acceptance/aggregation.js @@ -456,9 +456,14 @@ describe('aggregation', function () { ' Aggregation is available only for geometry type: ST_Point' ], errors_with_context:[{ - type: 'unknown', + type: 'layer', message: 'Unsupported geometry type: ST_Polygon.' + - ' Aggregation is available only for geometry type: ST_Point' + ' Aggregation is available only for geometry type: ST_Point', + layer: { + id: 'layer0', + index: 0, + type: 'mapnik' + } }] });