From 9519d0b1764797f75dbb0120764b301ae0d9958c Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 7 May 2016 15:18:41 +0200 Subject: [PATCH] Fix: Handle errors while saving nodes to the API --- main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 64dd6ab..256fa99 100644 --- a/main.go +++ b/main.go @@ -162,7 +162,9 @@ func main() { if cfg.NoOp { log.Printf("[NOOP] Would send a create to OSM (Changeset %d): %#v", cs.ID, h.ToNode()) } 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) } continue @@ -183,7 +185,9 @@ func main() { if cfg.NoOp { log.Printf("[NOOP] Would send a change to OSM (Changeset %d): To=%#v From=%#v", cs.ID, h.ToNode(), found.ToNode()) } 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) } }