From 8f2a171536854bd85f2b4d7afcee3db39c1241fd Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Wed, 27 Mar 2019 11:07:38 +0100 Subject: [PATCH] Fix #183 --- src/app/formulaire/ngparam.ts | 4 +++- src/locale/messages.en.json | 1 + src/locale/messages.fr.json | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/formulaire/ngparam.ts b/src/app/formulaire/ngparam.ts index 10ed51962..9d9ce7c9c 100644 --- a/src/app/formulaire/ngparam.ts +++ b/src/app/formulaire/ngparam.ts @@ -98,6 +98,7 @@ export class NgParameter extends InputField implements Observer { // calculated param ? if (targetParam.valueMode === ParamValueMode.CALCUL) { // was the result already computed ? + // @WAARNING .result might be set but the computation might have failed (dichotomy for ex.) if (p.referencedValue.nub.result) { if (p.referencedValue.hasMultipleValues()) { // like LIST mode @@ -110,7 +111,8 @@ export class NgParameter extends InputField implements Observer { if (vCalc) { valuePreview = String(vCalc.toFixed(nDigits)); } else { - throw new Error("NgParameter.preview() : No vCalc for computed target Nub !"); + // computation has been run but has failed + valuePreview = i18n.localizeText("INFO_PARAMFIELD_CALCULATION_FAILED"); } } } else { diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json index beb07be9f..d4e1a6420 100644 --- a/src/locale/messages.en.json +++ b/src/locale/messages.en.json @@ -159,6 +159,7 @@ "INFO_PARAMFIELD_GRAPH_TYPE_HISTOGRAM": "Histogram", "INFO_PARAMFIELD_GRAPH_SELECT_X_AXIS": "Variable for X axis", "INFO_PARAMFIELD_GRAPH_SELECT_Y_AXIS": "Variable for Y axis", + "INFO_PARAMFIELD_CALCULATION_FAILED": "Calculation failed", "INFO_PARAMFIELD_IN_CALCULATION": "In calculation", "INFO_PARAMFIELD_IN_CALCULATION_INITIAL_VALUE": "initial value", "INFO_PARAMFIELD_PARAMCALCULER": "Calculate", diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json index 2dddd1782..8627ade07 100644 --- a/src/locale/messages.fr.json +++ b/src/locale/messages.fr.json @@ -159,6 +159,7 @@ "INFO_PARAMFIELD_GRAPH_TYPE_HISTOGRAM": "Histogramme", "INFO_PARAMFIELD_GRAPH_SELECT_X_AXIS": "Variable en abscisse", "INFO_PARAMFIELD_GRAPH_SELECT_Y_AXIS": "Variable en ordonnée", + "INFO_PARAMFIELD_CALCULATION_FAILED": "Échec du calcul", "INFO_PARAMFIELD_IN_CALCULATION": "En calcul", "INFO_PARAMFIELD_IN_CALCULATION_INITIAL_VALUE": "valeur initiale", "INFO_PARAMFIELD_PARAMCALCULER": "calculer", -- GitLab