diff --git a/src/services/exporter.ts b/src/services/exporter.ts index a1fe347..e35bbb3 100644 --- a/src/services/exporter.ts +++ b/src/services/exporter.ts @@ -129,15 +129,15 @@ export class Exporter { } private _validateQueries(queries: DashboardQuery[]) { - if(!queries || !Array.isArray(queries)) { + if(!_.isArray(queries)) { throw new Error('`queries` field is required and should be an array'); } for(const query of queries) { - if(!_.isEmpty(query.datasource)) { + if(_.isEmpty(query.datasource)) { throw new Error('all queries should have a `datasource` field'); } - if(!_.isEmpty(query.panel.targets)) { + if(_.isEmpty(query.panel.targets)) { throw new Error('all queries should have a `panel` field with non-empty `targets` field'); } }