mirror of
https://github.com/Luzifer/gpxhydrant.git
synced 2024-12-22 20:21:17 +00:00
Fix: Handle errors while saving nodes to the API
This commit is contained in:
parent
b024d1569d
commit
9519d0b176
1 changed files with 6 additions and 2 deletions
8
main.go
8
main.go
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue