gps-track: add error handling

This commit is contained in:
Christian Hesse 2023-06-13 09:28:32 +02:00
parent 679c971ea6
commit 1e29eeb388

View file

@ -24,6 +24,7 @@ $WaitFullyConnected;
: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 {
/tool/fetch check-certificate=yes-without-crl $GpsTrackUrl output=none \ /tool/fetch check-certificate=yes-without-crl $GpsTrackUrl output=none \
http-method=post http-header-field="Content-Type: application/json" \ http-method=post http-header-field="Content-Type: application/json" \
http-data=("{" . \ http-data=("{" . \
@ -34,6 +35,9 @@ $WaitFullyConnected;
$LogPrintExit2 debug $0 ("Sending GPS data in " . $CoordinateFormat . " format: " . \ $LogPrintExit2 debug $0 ("Sending GPS data in " . $CoordinateFormat . " format: " . \
"lat: " . ($Gps->"latitude") . " " . \ "lat: " . ($Gps->"latitude") . " " . \
"lon: " . ($Gps->"longitude")) false; "lon: " . ($Gps->"longitude")) false;
} on-error={
$LogPrintExit2 warning $0 ("Failed sending GPS data!") false;
}
} else={ } else={
$LogPrintExit2 debug $0 ("GPS data not valid.") false; $LogPrintExit2 debug $0 ("GPS data not valid.") false;
} }