Commit 52454bf4 authored by twanvl's avatar twanvl

Slightly more information on script errors in keyword reminder text

parent 7a5b0613
...@@ -591,7 +591,12 @@ String KeywordDatabase::expand(const String& text, ...@@ -591,7 +591,12 @@ String KeywordDatabase::expand(const String& text,
// Combine keyword & reminder with result // Combine keyword & reminder with result
if (expand) { if (expand) {
String reminder = kw->reminder.invoke(ctx)->toString(); String reminder;
try {
reminder = kw->reminder.invoke(ctx)->toString();
} catch (const Error& e) {
handle_error(_ERROR_2_("in keyword reminder", e.what(), kw->keyword), true, false);
}
ctx.setVariable(_("keyword"), to_script(total)); ctx.setVariable(_("keyword"), to_script(total));
ctx.setVariable(_("reminder"), to_script(reminder)); ctx.setVariable(_("reminder"), to_script(reminder));
result += _("<kw-"); result += expand_type; result += _(">"); result += _("<kw-"); result += expand_type; result += _(">");
......
...@@ -335,7 +335,11 @@ SCRIPT_RULE_2_N_DEP(expand_keywords, ScriptValueP, _("default expand"), default_ ...@@ -335,7 +335,11 @@ SCRIPT_RULE_2_N_DEP(expand_keywords, ScriptValueP, _("default expand"), default_
} }
SCRIPT_OPTIONAL_PARAM_C_(CardP, card); SCRIPT_OPTIONAL_PARAM_C_(CardP, card);
WITH_DYNAMIC_ARG(keyword_usage_statistics, card ? &card->keyword_usage : nullptr); WITH_DYNAMIC_ARG(keyword_usage_statistics, card ? &card->keyword_usage : nullptr);
SCRIPT_RETURN(db.expand(input, default_expand, combine, ctx)); try {
SCRIPT_RETURN(db.expand(input, default_expand, combine, ctx));
} catch (const Error& e) {
throw ScriptError(_ERROR_2_("in function", e.what(), _("expand_keywords")));
}
} }
SCRIPT_RULE_2_DEPENDENCIES(expand_keywords) { SCRIPT_RULE_2_DEPENDENCIES(expand_keywords) {
default_expand->dependencies(ctx, dep); default_expand->dependencies(ctx, dep);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment