Improve error context
This commit is contained in:
parent
e2bd97eea6
commit
2dda0a80da
@ -117,5 +117,4 @@ module.exports = class AggregationMapConfig extends MapConfig {
|
||||
|
||||
return featureCount >= threshold;
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -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)) {
|
||||
|
@ -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'
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user