mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-01-23 01:19:33 +00:00
global-functions: $ExitError: drop argument $ExitOK...
... as the is no longer required with early exit with :exit.
This commit is contained in:
parent
eb182fe769
commit
2e422a153f
69 changed files with 83 additions and 86 deletions
|
|
@ -474,18 +474,15 @@
|
|||
|
||||
# simple macro to print error message on unintentional error
|
||||
:set ExitError do={
|
||||
:local ExitOK [ :tostr $1 ];
|
||||
:local Name [ :tostr $2 ];
|
||||
:local Error [ :tostr $3 ];
|
||||
:local Name [ :tostr $1 ];
|
||||
:local Error [ :tostr $2 ];
|
||||
|
||||
:global IfThenElse;
|
||||
:global LogPrint;
|
||||
|
||||
:if ($ExitOK = "false") do={
|
||||
$LogPrint error $Name ([ $IfThenElse ([ :pick $Name 0 1 ] = "\$") \
|
||||
"Function" "Script" ] . " '" . $Name . "' exited with error" . \
|
||||
[ $IfThenElse (!($Error ~ "^(|true|false)\$")) (": " . $Error) "." ]);
|
||||
}
|
||||
$LogPrint error $Name ([ $IfThenElse ([ :pick $Name 0 1 ] = "\$") \
|
||||
"Function" "Script" ] . " '" . $Name . "' exited with error" . \
|
||||
[ $IfThenElse (!($Error ~ "^(|true|false)\$")) (": " . $Error) "." ]);
|
||||
}
|
||||
|
||||
# fetch huge data to file, read in chunks
|
||||
|
|
@ -1503,7 +1500,7 @@
|
|||
:set GlobalConfigMigration;
|
||||
}
|
||||
} do={
|
||||
:global ExitError; $ExitError false $0 $Err;
|
||||
:global ExitError; $ExitError $0 $Err;
|
||||
} }
|
||||
|
||||
# lock script against multiple invocation
|
||||
|
|
@ -1649,7 +1646,7 @@
|
|||
|
||||
$SendNotification2 ({ origin=$0; subject=$1; message=$2; link=$3; silent=$4 });
|
||||
} do={
|
||||
:global ExitError; $ExitError false $0 $Err;
|
||||
:global ExitError; $ExitError $0 $Err;
|
||||
} }
|
||||
|
||||
# send notification via NotificationFunctions - expects one array argument
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue