aboutsummaryrefslogtreecommitdiffhomepage
path: root/config/configLoader.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2022-05-15 21:01:36 +0200
committerBjørn Erik Pedersen <[email protected]>2022-05-15 22:58:05 +0200
commit87a22eb6d609a65471ccf4de35a558e9669a4600 (patch)
tree229a520a61dac3c772104ab720613671d978f046 /config/configLoader.go
parentfc9f315d86e1fe51c3d1eec3b60680113b2e3aa6 (diff)
downloadhugo-87a22eb6d609a65471ccf4de35a558e9669a4600.tar.gz
hugo-87a22eb6d609a65471ccf4de35a558e9669a4600.zip
server: Fix SIGINT handling after loading bad configuration
Also fix the config error messages. Fixes #9664
Diffstat (limited to 'config/configLoader.go')
-rw-r--r--config/configLoader.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/config/configLoader.go b/config/configLoader.go
index d25546cdb..6722c12fd 100644
--- a/config/configLoader.go
+++ b/config/configLoader.go
@@ -59,6 +59,13 @@ func FromConfigString(config, configType string) (Provider, error) {
func FromFile(fs afero.Fs, filename string) (Provider, error) {
m, err := loadConfigFromFile(fs, filename)
if err != nil {
+ fe := herrors.UnwrapFileError(err)
+ if fe != nil {
+ pos := fe.Position()
+ pos.Filename = filename
+ fe.UpdatePosition(pos)
+ return nil, err
+ }
return nil, herrors.NewFileErrorFromFile(err, filename, fs, nil)
}
return NewFrom(m), nil