diff --git a/lib/cartodb/models/mapconfig/adapter/aggregation-mapconfig-adapter.js b/lib/cartodb/models/mapconfig/adapter/aggregation-mapconfig-adapter.js index a73e99a9..425aade7 100644 --- a/lib/cartodb/models/mapconfig/adapter/aggregation-mapconfig-adapter.js +++ b/lib/cartodb/models/mapconfig/adapter/aggregation-mapconfig-adapter.js @@ -18,7 +18,13 @@ module.exports = class AggregationMapConfigAdapter { return callback(new Error(invalidAggregationParamValueErrorMessage({ value: params.aggregation }))); } - const mapConfig = new AggregationMapConfig(requestMapConfig); + let mapConfig; + try { + mapConfig = new AggregationMapConfig(requestMapConfig); + } catch (err) { + return callback(err); + } + if (!this._shouldAdapt(mapConfig, params)) { return callback(null, requestMapConfig);