diff options
author | Bjørn Erik Pedersen <[email protected]> | 2022-05-15 21:01:36 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2022-05-15 22:58:05 +0200 |
commit | 87a22eb6d609a65471ccf4de35a558e9669a4600 (patch) | |
tree | 229a520a61dac3c772104ab720613671d978f046 /config/configLoader.go | |
parent | fc9f315d86e1fe51c3d1eec3b60680113b2e3aa6 (diff) | |
download | hugo-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.go | 7 |
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 |