mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-06-20 17:05:44 +02:00
sms-forward: :do ... on-error=... -> :onerror ... do=...
This commit is contained in:
parent
fefe59751f
commit
d0adf9974e
1 changed files with 3 additions and 3 deletions
|
@ -74,12 +74,12 @@
|
||||||
:if ($Phone~($Hook->"allowed-number") && ($SmsVal->"message")~($Hook->"match")) do={
|
:if ($Phone~($Hook->"allowed-number") && ($SmsVal->"message")~($Hook->"match")) do={
|
||||||
:if ([ $ValidateSyntax ($Hook->"command") ] = true) do={
|
:if ([ $ValidateSyntax ($Hook->"command") ] = true) do={
|
||||||
$LogPrint info $ScriptName ("Running hook '" . $Hook->"match" . "': " . $Hook->"command");
|
$LogPrint info $ScriptName ("Running hook '" . $Hook->"match" . "': " . $Hook->"command");
|
||||||
:do {
|
:onerror Err {
|
||||||
:local Command [ :parse ($Hook->"command") ];
|
:local Command [ :parse ($Hook->"command") ];
|
||||||
$Command Phone=$Phone Message=($SmsVal->"message");
|
$Command Phone=$Phone Message=($SmsVal->"message");
|
||||||
:set Messages ($Messages . "\n\nRan hook '" . $Hook->"match" . "':\n" . $Hook->"command");
|
:set Messages ($Messages . "\n\nRan hook '" . $Hook->"match" . "':\n" . $Hook->"command");
|
||||||
} on-error={
|
} do={
|
||||||
$LogPrint warning $ScriptName ("The code for hook '" . $Hook->"match" . "' failed to run!");
|
$LogPrint warning $ScriptName ("The code for hook '" . $Hook->"match" . "' failed to run: " . $Err);
|
||||||
}
|
}
|
||||||
} else={
|
} else={
|
||||||
$LogPrint warning $ScriptName ("The code for hook '" . $Hook->"match" . "' failed syntax validation!");
|
$LogPrint warning $ScriptName ("The code for hook '" . $Hook->"match" . "' failed syntax validation!");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue