main: Improve / clean up error messages (#4286)

Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
Julius Volz 2018-07-18 09:58:40 +02:00 committed by GitHub
parent 912d19fb85
commit 03aa3a3de8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -493,7 +493,7 @@ func main() {
} }
if err := reloadConfig(cfg.configFile, logger, reloaders...); err != nil { if err := reloadConfig(cfg.configFile, logger, reloaders...); err != nil {
return fmt.Errorf("Error loading config %s", err) return fmt.Errorf("error loading config from %q: %s", cfg.configFile, err)
} }
reloadReady.Close() reloadReady.Close()
@ -538,7 +538,7 @@ func main() {
&cfg.tsdb, &cfg.tsdb,
) )
if err != nil { if err != nil {
return fmt.Errorf("Opening storage failed %s", err) return fmt.Errorf("opening storage failed: %s", err)
} }
level.Info(logger).Log("msg", "TSDB started") level.Info(logger).Log("msg", "TSDB started")
@ -561,7 +561,7 @@ func main() {
g.Add( g.Add(
func() error { func() error {
if err := webHandler.Run(ctxWeb); err != nil { if err := webHandler.Run(ctxWeb); err != nil {
return fmt.Errorf("Error starting web server: %s", err) return fmt.Errorf("error starting web server: %s", err)
} }
return nil return nil
}, },
@ -613,7 +613,7 @@ func reloadConfig(filename string, logger log.Logger, rls ...func(*config.Config
conf, err := config.LoadFile(filename) conf, err := config.LoadFile(filename)
if err != nil { if err != nil {
return fmt.Errorf("couldn't load configuration (--config.file=%s): %v", filename, err) return fmt.Errorf("couldn't load configuration (--config.file=%q): %v", filename, err)
} }
failed := false failed := false
@ -624,7 +624,7 @@ func reloadConfig(filename string, logger log.Logger, rls ...func(*config.Config
} }
} }
if failed { if failed {
return fmt.Errorf("one or more errors occurred while applying the new configuration (--config.file=%s)", filename) return fmt.Errorf("one or more errors occurred while applying the new configuration (--config.file=%q)", filename)
} }
level.Info(logger).Log("msg", "Completed loading of configuration file", "filename", filename) level.Info(logger).Log("msg", "Completed loading of configuration file", "filename", filename)
return nil return nil