aboutsummaryrefslogtreecommitdiffstats
path: root/gps-track.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-06-13 09:28:32 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-06-13 09:28:32 +0200
commit1e29eeb388dff8f9cbb7e47e53146d4da87d3c81 (patch)
treebe292784d5a88672ac8e7ec7083fb1d759fa21e3 /gps-track.rsc
parent679c971ea6b6ffb3a64e48e74526d0f9a3357725 (diff)
gps-track: add error handling
Diffstat (limited to 'gps-track.rsc')
-rw-r--r--gps-track.rsc24
1 files changed, 14 insertions, 10 deletions
diff --git a/gps-track.rsc b/gps-track.rsc
index 29d2572..0d328d5 100644
--- a/gps-track.rsc
+++ b/gps-track.rsc
@@ -24,16 +24,20 @@ $WaitFullyConnected;
:local Gps [ /system/gps/monitor once as-value ];
:if ($Gps->"valid" = true) do={
- /tool/fetch check-certificate=yes-without-crl $GpsTrackUrl output=none \
- http-method=post http-header-field="Content-Type: application/json" \
- http-data=("{" . \
- "\"lat\":\"" . ($Gps->"latitude") . "\"," . \
- "\"lon\":\"" . ($Gps->"longitude") . "\"," . \
- "\"identity\":\"" . $Identity . "\"" . \
- "}") as-value;
- $LogPrintExit2 debug $0 ("Sending GPS data in " . $CoordinateFormat . " format: " . \
- "lat: " . ($Gps->"latitude") . " " . \
- "lon: " . ($Gps->"longitude")) false;
+ :do {
+ /tool/fetch check-certificate=yes-without-crl $GpsTrackUrl output=none \
+ http-method=post http-header-field="Content-Type: application/json" \
+ http-data=("{" . \
+ "\"lat\":\"" . ($Gps->"latitude") . "\"," . \
+ "\"lon\":\"" . ($Gps->"longitude") . "\"," . \
+ "\"identity\":\"" . $Identity . "\"" . \
+ "}") as-value;
+ $LogPrintExit2 debug $0 ("Sending GPS data in " . $CoordinateFormat . " format: " . \
+ "lat: " . ($Gps->"latitude") . " " . \
+ "lon: " . ($Gps->"longitude")) false;
+ } on-error={
+ $LogPrintExit2 warning $0 ("Failed sending GPS data!") false;
+ }
} else={
$LogPrintExit2 debug $0 ("GPS data not valid.") false;
}