mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-08 17:14:29 +02:00
global-functions: introduce $ExitError...
... as a simple macro to print error message on unintentional error.
This commit is contained in:
parent
48bcf8ee6e
commit
0d69f8952c
1 changed files with 13 additions and 0 deletions
|
@ -32,6 +32,7 @@
|
|||
:global DownloadPackage;
|
||||
:global EitherOr;
|
||||
:global EscapeForRegEx;
|
||||
:global ExitError;
|
||||
:global FetchHuge;
|
||||
:global FetchUserAgentStr;
|
||||
:global FormatLine;
|
||||
|
@ -425,6 +426,18 @@
|
|||
:return $Return;
|
||||
}
|
||||
|
||||
# simple macro to print error message on unintentional error
|
||||
:set ExitError do={
|
||||
:local ExitOK [ :tostr $1 ];
|
||||
:local ScriptName [ :tostr $2 ];
|
||||
|
||||
:global LogPrint;
|
||||
|
||||
:if ($ExitOK = "false") do={
|
||||
$LogPrint error $ScriptName ("Script exited with error.");
|
||||
}
|
||||
}
|
||||
|
||||
# fetch huge data to file, read in chunks
|
||||
:set FetchHuge do={
|
||||
:local ScriptName [ :tostr $1 ];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue