gps-track: :do ... on-error=... -> :onerror ... do=...

This commit is contained in:
Christian Hesse 2025-05-08 09:41:57 +02:00
parent 5c599beae1
commit d5f9ecebfb

View file

@ -34,7 +34,7 @@
:local Gps [ /system/gps/monitor once as-value ]; :local Gps [ /system/gps/monitor once as-value ];
:if ($Gps->"valid" = true) do={ :if ($Gps->"valid" = true) 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=({ [ $FetchUserAgentStr $ScriptName ]; "Content-Type: application/json" }) \ http-header-field=({ [ $FetchUserAgentStr $ScriptName ]; "Content-Type: application/json" }) \
http-data=[ :serialize to=json { "identity"=$Identity; \ http-data=[ :serialize to=json { "identity"=$Identity; \
@ -42,8 +42,8 @@
$LogPrint debug $ScriptName ("Sending GPS data in " . $CoordinateFormat . " format: " . \ $LogPrint debug $ScriptName ("Sending GPS data in " . $CoordinateFormat . " format: " . \
"lat: " . ($Gps->"latitude") . " " . \ "lat: " . ($Gps->"latitude") . " " . \
"lon: " . ($Gps->"longitude")); "lon: " . ($Gps->"longitude"));
} on-error={ } do={
$LogPrint warning $ScriptName ("Failed sending GPS data!"); $LogPrint warning $ScriptName ("Failed sending GPS data: " . $Err);
} }
} else={ } else={
$LogPrint debug $ScriptName ("GPS data not valid."); $LogPrint debug $ScriptName ("GPS data not valid.");