aboutsummaryrefslogtreecommitdiffstats
path: root/mod/notification-ntfy.rsc
diff options
context:
space:
mode:
Diffstat (limited to 'mod/notification-ntfy.rsc')
-rw-r--r--mod/notification-ntfy.rsc25
1 files changed, 12 insertions, 13 deletions
diff --git a/mod/notification-ntfy.rsc b/mod/notification-ntfy.rsc
index aac6d6c..7114020 100644
--- a/mod/notification-ntfy.rsc
+++ b/mod/notification-ntfy.rsc
@@ -16,9 +16,8 @@
:global SendNtfy2;
# flush ntfy queue
-:set FlushNtfyQueue do={ :do {
+:set FlushNtfyQueue do={ :onerror Err {
:global NtfyQueue;
- :global NtfyMessageIDs;
:global IsFullyConnected;
:global LogPrint;
@@ -37,13 +36,13 @@
:foreach Id,Message in=$NtfyQueue do={
:if ([ :typeof $Message ] = "array" ) do={
- :do {
+ :onerror Err {
/tool/fetch check-certificate=yes-without-crl output=none http-method=post \
http-header-field=($Message->"headers") http-data=($Message->"text") \
($Message->"url") as-value;
:set ($NtfyQueue->$Id);
- } on-error={
- $LogPrint debug $0 ("Sending queued Ntfy message failed.");
+ } do={
+ $LogPrint debug $0 ("Sending queued Ntfy message failed: " . $Err);
:set AllDone false;
}
}
@@ -53,8 +52,8 @@
/system/scheduler/remove [ find where name="_FlushNtfyQueue" ];
:set NtfyQueue;
}
-} on-error={
- :global ExitError; $ExitError false $0;
+} do={
+ :global ExitError; $ExitError false $0 $Err;
} }
# send notification via ntfy - expects one array argument
@@ -108,7 +107,7 @@
:set Text ($Text . "\n" . [ $SymbolForNotification "link" ] . ($Notification->"link"));
}
- :do {
+ :onerror Err {
:if ($Server = "ntfy.sh") do={
:if ([ $CertificateAvailable "ISRG Root X1" ] = false) do={
$LogPrint warning $0 ("Downloading required certificate failed.");
@@ -117,8 +116,8 @@
}
/tool/fetch check-certificate=yes-without-crl output=none http-method=post \
http-header-field=$Headers http-data=$Text $Url as-value;
- } on-error={
- $LogPrint info $0 ("Failed sending ntfy notification! Queuing...");
+ } do={
+ $LogPrint info $0 ("Failed sending ntfy notification: " . $Err . " - Queuing...");
:if ([ :typeof $NtfyQueue ] = "nothing") do={
:set NtfyQueue ({});
@@ -144,12 +143,12 @@
}
# send notification via ntfy - expects at least two string arguments
-:set SendNtfy do={ :do {
+:set SendNtfy do={ :onerror Err {
:global SendNtfy2;
$SendNtfy2 ({ origin=$0; subject=$1; message=$2; link=$3; silent=$4 });
-} on-error={
- :global ExitError; $ExitError false $0;
+} do={
+ :global ExitError; $ExitError false $0 $Err;
} }
# send notification via ntfy - expects one array argument