From 7a478c1c0ad3ed1540a2c0f3a7c52a4b03e4e283 Mon Sep 17 00:00:00 2001 From: Mael Date: Wed, 26 Sep 2018 13:00:05 +0000 Subject: [PATCH] :doc: Message d'erreur quand objectif de calcul inconnu --- source/engine/traverse.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/engine/traverse.js b/source/engine/traverse.js index 166365e2d..8745fb12f 100644 --- a/source/engine/traverse.js +++ b/source/engine/traverse.js @@ -333,7 +333,14 @@ export let analyseMany = (parsedRules, targetNames) => situationGate => { } let nonBlockingControls = evaluateControls(false)(parsedRules, situationGate) - let parsedTargets = targetNames.map(t => findRule(parsedRules, t)), + let parsedTargets = targetNames.map(t => { + let parsedTarget = findRule(parsedRules, t) + if (!parsedTarget) + throw new Error( + `L'objectif de calcul "${t}" ne semble pas exister dans la base de règles` + ) + return parsedTarget + }), targets = chain(pt => getTargets(pt, parsedRules), parsedTargets).map(t => evaluateNode(cache, situationGate, parsedRules, t) )