mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
global-functions: catch runtime error when loading modules
This commit is contained in:
@ -1269,7 +1269,11 @@
|
|||||||
:foreach Script in=[ / system script find where name ~ "^mod/." ] do={
|
:foreach Script in=[ / system script find where name ~ "^mod/." ] do={
|
||||||
:local ScriptVal [ / system script get $Script ];
|
:local ScriptVal [ / system script get $Script ];
|
||||||
:if ([ $ValidateSyntax ($ScriptVal->"source") ] = true) do={
|
:if ([ $ValidateSyntax ($ScriptVal->"source") ] = true) do={
|
||||||
|
:do {
|
||||||
/ system script run $Script;
|
/ system script run $Script;
|
||||||
|
} on-error={
|
||||||
|
$LogPrintExit2 error $0 ("Module '" . $ScriptVal->"name" . "' failed to run.") false;
|
||||||
|
}
|
||||||
} else={
|
} else={
|
||||||
$LogPrintExit2 error $0 ("Module '" . $ScriptVal->"name" . "' failed syntax validation, skipping.") false;
|
$LogPrintExit2 error $0 ("Module '" . $ScriptVal->"name" . "' failed syntax validation, skipping.") false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user