From c300995583d712a03fa7aa004be411e5294a8c17 Mon Sep 17 00:00:00 2001
From: srosse <stephane.rosse@frentix.com>
Date: Sat, 21 Mar 2020 18:16:15 +0100
Subject: [PATCH] OO-4587: replacte red screen with an error message

---
 .../olat/course/condition/_i18n/LocalStrings_de.properties   | 1 +
 .../olat/course/condition/_i18n/LocalStrings_en.properties   | 1 +
 .../olat/course/condition/_i18n/LocalStrings_fr.properties   | 1 +
 .../course/condition/interpreter/ConditionInterpreter.java   | 5 +++--
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/olat/course/condition/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/course/condition/_i18n/LocalStrings_de.properties
index c8d9b6f8902..ba39618ea3a 100644
--- a/src/main/java/org/olat/course/condition/_i18n/LocalStrings_de.properties
+++ b/src/main/java/org/olat/course/condition/_i18n/LocalStrings_de.properties
@@ -35,6 +35,7 @@ error.nameTooLong=Der/die angegebene Name(n) ist/sind zu lang. Erlaubt sind max.
 error.undefined.function.at=Die Funktion bei Zeichen {0} ist unbekannt, konsultieren Sie die Hilfe f\u00FCr erlaubte Funktionen.
 error.undefined.unit.at=Die Einheit bei Zeichen {0} ist unbekannt, konsultieren Sie die Hilfe f\u00FCr erlaubte Einheiten.
 error.undefined.variable.at=Die Variable bei Zeichen {0} ist unbekannt, konsultieren Sie die Hilfe f\u00FCr erlaubte Variablen.
+error.unkown=Ein unerwarteter Fehler ist aufgetreten.
 form.easy.applyRulesForCoach=Regeln auch bei Besitzern und Betreuern anwenden
 form.easy.area=Nur f\u00FCr die Lernbereiche
 form.easy.assessmentSwitch=Bewertungsabh\u00E4ngig
diff --git a/src/main/java/org/olat/course/condition/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/course/condition/_i18n/LocalStrings_en.properties
index 89cdef79bbc..0881c7e7f03 100644
--- a/src/main/java/org/olat/course/condition/_i18n/LocalStrings_en.properties
+++ b/src/main/java/org/olat/course/condition/_i18n/LocalStrings_en.properties
@@ -35,6 +35,7 @@ error.notfound.names=The specified names ({1}) were not found within the group m
 error.undefined.function.at=The function at position {0} is unknown, see Help for possible functions.
 error.undefined.unit.at=The unit at position {0} is unknown, see Help for possible units.
 error.undefined.variable.at=The variable at position {0} is unknown, see Help for possible variables.
+error.unkown=An unexpected error occurred.
 form.easy.applyRulesForCoach=Apply rules also for owners and tutors
 form.easy.area=Only for learning areas
 form.easy.assessmentSwitch=Depending on assessment
diff --git a/src/main/java/org/olat/course/condition/_i18n/LocalStrings_fr.properties b/src/main/java/org/olat/course/condition/_i18n/LocalStrings_fr.properties
index 64bf4cc7be3..5104224f9ef 100644
--- a/src/main/java/org/olat/course/condition/_i18n/LocalStrings_fr.properties
+++ b/src/main/java/org/olat/course/condition/_i18n/LocalStrings_fr.properties
@@ -73,6 +73,7 @@ form.easy.groupSwitch=D\u00E9pendant du groupe
 solution.provideone.date=Conseil\: Exactement une indication de temps est n\u00E9cessaire pour la fonction "{0}". Le format est "jj.mm.AAAA HH\:mm".
 mode.easy=Facile
 error.undefined.unit.at=L'unit\u00E9 est inconnue pour le signe {0}, consultez l'aide pour les unit\u00E9s autoris\u00E9es.
+error.unkown=Une erreur inattendue s'est produite.
 form.easy.nodePassed.noNodes=Pas possible - aucun \u00E9l\u00E9ment de cours \u00E9valu\u00E9
 form.easy.error.group=Il faut indiquer au moins un groupe d'\u00E9tude ou un domaine d'\u00E9tude.
 form.easy.error.edate=Format de date erron\u00E9
diff --git a/src/main/java/org/olat/course/condition/interpreter/ConditionInterpreter.java b/src/main/java/org/olat/course/condition/interpreter/ConditionInterpreter.java
index 3ffbd6412f1..2f9543c5e73 100644
--- a/src/main/java/org/olat/course/condition/interpreter/ConditionInterpreter.java
+++ b/src/main/java/org/olat/course/condition/interpreter/ConditionInterpreter.java
@@ -264,8 +264,9 @@ public class ConditionInterpreter {
 			msg = "error.divide.by.zero";
 			params = new String[]{};
 		} catch (Exception ex) {
-			// this must not happen!
-			throw new OLATRuntimeException(ex.getMessage(), ex);
+			log.error("Unexpected syntax error", ex);
+			msg = "error.unkown";
+			params = new String[]{};
 		}
 		return new ConditionErrorMessage(msg, solutionMsg, params);
 	}
-- 
GitLab