Catch error threw from constructor and follow node callback pattern
This commit is contained in:
parent
326cad2f2c
commit
f22216e6d2
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user