From 37e772b595dd498ab4f620a1080abec749527cd4 Mon Sep 17 00:00:00 2001 From: Adhityaa Date: Sat, 9 Jun 2018 14:02:07 +0530 Subject: [PATCH] api: use Errorf instead of Fatalf --- api/config.go | 4 ++-- api/smtp_templates.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/config.go b/api/config.go index 7b8c963..4f32ba1 100644 --- a/api/config.go +++ b/api/config.go @@ -9,7 +9,7 @@ import ( func parseConfig() error { binPath, err := filepath.Abs(filepath.Dir(os.Args[0])) if err != nil { - logger.Fatalf("cannot load binary path: %v", err) + logger.Errorf("cannot load binary path: %v", err) return err } @@ -43,7 +43,7 @@ func parseConfig() error { // Mandatory config parameters for _, env := range []string{"POSTGRES", "PORT", "ORIGIN"} { if os.Getenv(env) == "" { - logger.Fatalf("missing %s environment variable", env) + logger.Errorf("missing %s environment variable", env) return errorMissingConfig } } diff --git a/api/smtp_templates.go b/api/smtp_templates.go index 1f42f15..add8522 100644 --- a/api/smtp_templates.go +++ b/api/smtp_templates.go @@ -27,7 +27,7 @@ Subject: {{.Subject}} `) if err != nil { - logger.Fatalf("cannot parse header template: %v", err) + logger.Errorf("cannot parse header template: %v", err) return errorMalformedTemplate } @@ -41,7 +41,7 @@ Subject: {{.Subject}} templates[name] = template.New(name) templates[name], err = template.ParseFiles(fmt.Sprintf("%s/templates/%s.html", os.Getenv("COMMENTO_STATIC"), name)) if err != nil { - logger.Fatalf("cannot parse %s/templates/%s.html: %v", os.Getenv("STATIC"), name, err) + logger.Errorf("cannot parse %s/templates/%s.html: %v", os.Getenv("STATIC"), name, err) return errorMalformedTemplate } }