global-functions: catch runtime error when loading modules

This commit is contained in:
Christian Hesse 2022-04-28 09:55:28 +02:00
parent 7c8e230521
commit e74bec7e5b

View file

@ -1269,7 +1269,11 @@
:foreach Script in=[ / system script find where name ~ "^mod/." ] do={
:local ScriptVal [ / system script get $Script ];
:if ([ $ValidateSyntax ($ScriptVal->"source") ] = true) do={
/ system script run $Script;
:do {
/ system script run $Script;
} on-error={
$LogPrintExit2 error $0 ("Module '" . $ScriptVal->"name" . "' failed to run.") false;
}
} else={
$LogPrintExit2 error $0 ("Module '" . $ScriptVal->"name" . "' failed syntax validation, skipping.") false;
}