From 59ef4c21fe0037635b9923b09566586fce50dc01 Mon Sep 17 00:00:00 2001 From: rozetko Date: Mon, 28 May 2018 13:38:51 +0300 Subject: [PATCH] 142-hastic-server-anomalies-file-missing --- server/src/services/anomalyType.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/src/services/anomalyType.ts b/server/src/services/anomalyType.ts index bf23943..58d4937 100644 --- a/server/src/services/anomalyType.ts +++ b/server/src/services/anomalyType.ts @@ -37,6 +37,9 @@ let anomaliesNameToIdMap = {}; function loadAnomaliesMap() { let filename = path.join(ANOMALIES_PATH, `all_anomalies.json`); + if(!fs.existsSync(filename)) { + saveAnomaliesMap(); + } anomaliesNameToIdMap = getJsonDataSync(filename); }