mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-01-21 16:39:32 +00:00
global-functions: make $ExitError a wrapper for $ExitOnError
This commit is contained in:
parent
8f32d8e705
commit
b436e39db5
1 changed files with 3 additions and 6 deletions
|
|
@ -474,19 +474,16 @@
|
|||
:return $Return;
|
||||
}
|
||||
|
||||
# simple macro to print error message on unintentional error
|
||||
# wrapper for $ExitOnError with additional parameter
|
||||
:set ExitError do={
|
||||
:local ExitOK [ :tostr $1 ];
|
||||
:local Name [ :tostr $2 ];
|
||||
:local Error [ :tostr $3 ];
|
||||
|
||||
:global IfThenElse;
|
||||
:global LogPrint;
|
||||
:global ExitOnError;
|
||||
|
||||
:if ($ExitOK = "false") do={
|
||||
$LogPrint error $Name ([ $IfThenElse ([ :pick $Name 0 1 ] = "\$") \
|
||||
"Function" "Script" ] . " '" . $Name . "' exited with error" . \
|
||||
[ $IfThenElse (!($Error ~ "^(|true|false)\$")) (": " . $Error) "." ]);
|
||||
$ExitOnError $Name $Error;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue