mod/notification-gotify: :do ... on-error=... -> :onerror ... do=...

This commit is contained in:
Christian Hesse 2025-05-08 09:58:53 +02:00
parent 3f092d3477
commit e01873301f

View file

@ -37,13 +37,13 @@
:foreach Id,Message in=$GotifyQueue do={ :foreach Id,Message in=$GotifyQueue do={
:if ([ :typeof $Message ] = "array" ) do={ :if ([ :typeof $Message ] = "array" ) do={
:do { :onerror Err {
/tool/fetch check-certificate=yes-without-crl output=none http-method=post \ /tool/fetch check-certificate=yes-without-crl output=none http-method=post \
http-header-field=($Message->"headers") http-data=[ :serialize to=json ($Message->"message") ] \ http-header-field=($Message->"headers") http-data=[ :serialize to=json ($Message->"message") ] \
($Message->"url") as-value; ($Message->"url") as-value;
:set ($GotifyQueue->$Id); :set ($GotifyQueue->$Id);
} on-error={ } do={
$LogPrint debug $0 ("Sending queued Gotify message failed."); $LogPrint debug $0 ("Sending queued Gotify message failed: " . $Err);
:set AllDone false; :set AllDone false;
} }
} }
@ -91,11 +91,11 @@
("\n" . [ $SymbolForNotification "link" ] . ($Notification->"link")) ]); \ ("\n" . [ $SymbolForNotification "link" ] . ($Notification->"link")) ]); \
"priority"=[ :tonum [ $IfThenElse ($Notification->"silent") 2 5 ] ] }); "priority"=[ :tonum [ $IfThenElse ($Notification->"silent") 2 5 ] ] });
:do { :onerror Err {
/tool/fetch check-certificate=yes-without-crl output=none http-method=post \ /tool/fetch check-certificate=yes-without-crl output=none http-method=post \
http-header-field=$Headers http-data=[ :serialize to=json $Message ] $Url as-value; http-header-field=$Headers http-data=[ :serialize to=json $Message ] $Url as-value;
} on-error={ } do={
$LogPrint info $0 ("Failed sending Gotify notification! Queuing..."); $LogPrint info $0 ("Failed sending Gotify notification: " . $Err . " - Queuing...");
:if ([ :typeof $GotifyQueue ] = "nothing") do={ :if ([ :typeof $GotifyQueue ] = "nothing") do={
:set GotifyQueue ({}); :set GotifyQueue ({});