1
0
Fork 0
mirror of https://github.com/Luzifer/gpxhydrant.git synced 2024-12-23 04:31:18 +00:00

Fix: Handle errors while saving nodes to the API

This commit is contained in:
Knut Ahlers 2016-05-07 15:18:41 +02:00
parent b024d1569d
commit 9519d0b176
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -162,7 +162,9 @@ func main() {
if cfg.NoOp { if cfg.NoOp {
log.Printf("[NOOP] Would send a create to OSM (Changeset %d): %#v", cs.ID, h.ToNode()) log.Printf("[NOOP] Would send a create to OSM (Changeset %d): %#v", cs.ID, h.ToNode())
} else { } else {
osmClient.SaveNode(h.ToNode(), cs) if err := osmClient.SaveNode(h.ToNode(), cs); err != nil {
log.Fatalf("Unable to create node using the OSM API: %s", err)
}
logDebugf("Created a hydrant: %s", h.Name) logDebugf("Created a hydrant: %s", h.Name)
} }
continue continue
@ -183,7 +185,9 @@ func main() {
if cfg.NoOp { if cfg.NoOp {
log.Printf("[NOOP] Would send a change to OSM (Changeset %d): To=%#v From=%#v", cs.ID, h.ToNode(), found.ToNode()) log.Printf("[NOOP] Would send a change to OSM (Changeset %d): To=%#v From=%#v", cs.ID, h.ToNode(), found.ToNode())
} else { } else {
osmClient.SaveNode(h.ToNode(), cs) if err := osmClient.SaveNode(h.ToNode(), cs); err != nil {
log.Fatalf("Unable to create node using the OSM API: %s", err)
}
logDebugf("Changed a hydrant: %s", h.Name) logDebugf("Changed a hydrant: %s", h.Name)
} }
} }