[aggParams/field] throw better error when field missing

This commit is contained in:
spalger 2016-10-17 13:33:26 -07:00
parent 0190cda30e
commit 1ee969c97a

View file

@ -53,7 +53,11 @@ export default function FieldAggParamFactory(Private) {
* @return {undefined}
*/
FieldAggParam.prototype.write = function (aggConfig, output) {
let field = aggConfig.params.field;
let field = aggConfig.getField();
if (!field) {
throw new Error(`"${aggConfig.makeLabel()}" requires a field`);
}
if (field.scripted) {
output.params.script = {