From 8c2441924c2b6e2b7893c84e8b94d2a170697ac8 Mon Sep 17 00:00:00 2001 From: Florian Barth Date: Tue, 1 Aug 2017 07:56:51 +0200 Subject: [PATCH] Move error handling for parsing up into the labelCollections service --- main.go | 4 +++- tileconfig.go | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 43027bf..69325d1 100644 --- a/main.go +++ b/main.go @@ -66,6 +66,8 @@ var dsMap map[string]*C.Datastructure // pRootEndpoint is the path prefix for all label collection var pRootEndpoint string +// renderdConfigPath contains the path to renderd.conf. It is used for +// the labelCollections endpoint var renderdConfigPath string func main() { @@ -214,7 +216,7 @@ func getLabelCollections(w http.ResponseWriter, r *http.Request) { } tileEndpoints, err := parseEndpoints(renderdConfigPath) if err != nil { - // TODO: 500 Status + log.Printf("Error during parsing: %s ", err.Error()) } labelCollection := labelCollectionResult{ pRootEndpoint, diff --git a/tileconfig.go b/tileconfig.go index e3b1ceb..6865924 100644 --- a/tileconfig.go +++ b/tileconfig.go @@ -1,8 +1,6 @@ package main import ( - "log" - "github.com/Terry-Mao/goconf" ) @@ -20,7 +18,7 @@ func parseEndpoints(file string) ([]tileEndpoint, error) { conf.Spliter = "=" conf.Comment = ";" if err := conf.Parse(file); err != nil { - log.Printf("Error during parsing: %s ", err.Error()) + return nil, err } for _, sectionName := range conf.Sections() {