aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions.rsc
diff options
context:
space:
mode:
Diffstat (limited to 'global-functions.rsc')
-rw-r--r--global-functions.rsc13
1 files changed, 13 insertions, 0 deletions
diff --git a/global-functions.rsc b/global-functions.rsc
index 6fec6dd..26ccc2a 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -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 ];