Handle error in config loading
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 9 Aug 2016 13:31:16 +0000 (15:31 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 6 Sep 2016 15:32:19 +0000 (18:32 +0300)
See #2309

commands/hugo.go

index d0885165834360bc797c28abeafea9fe86693d90..a8dc8778522cae81611143f8fb79601803044156 100644 (file)
@@ -278,7 +278,9 @@ func init() {
 
 // InitializeConfig initializes a config file with sensible default configuration flags.
 func InitializeConfig(subCmdVs ...*cobra.Command) error {
-       hugolib.LoadGlobalConfig(source, cfgFile)
+       if err := hugolib.LoadGlobalConfig(source, cfgFile); err != nil {
+               return err
+       }
 
        for _, cmdV := range append([]*cobra.Command{hugoCmdV}, subCmdVs...) {