mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-28 22:19:59 +02:00
server: Fix SIGINT handling after loading bad configuration
Also fix the config error messages. Fixes #9664
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user