From c5524b0babddb1ee2ac22293c24a00e0ddb8011e Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Wed, 17 Aug 2016 17:02:01 -0600 Subject: [PATCH] Report errors when loading Caddyfile --- plugins.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins.go b/plugins.go index 022674720..5134aa910 100644 --- a/plugins.go +++ b/plugins.go @@ -271,13 +271,14 @@ func loadCaddyfileInput(serverType string) (Input, error) { var loadedBy string var caddyfileToUse Input for _, l := range caddyfileLoaders { - if cdyfile, err := l.loader.Load(serverType); cdyfile != nil { + cdyfile, err := l.loader.Load(serverType) + if err != nil { + return nil, fmt.Errorf("loading Caddyfile via %s: %v", l.name, err) + } + if cdyfile != nil { if caddyfileToUse != nil { return nil, fmt.Errorf("Caddyfile loaded multiple times; first by %s, then by %s", loadedBy, l.name) } - if err != nil { - return nil, err - } loaderUsed = l caddyfileToUse = cdyfile loadedBy = l.name