summaryrefslogtreecommitdiffstats
path: root/commands/commandeer.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-09-17 17:16:34 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-09-17 17:16:34 +0200
commit13ad8408fc6b645b12898fb8053388fc4848dfbd (patch)
tree8296c314574c156248136c386eab13f008a06830 /commands/commandeer.go
parent1cabf61ddf96b89c95c3ba77a985168184920feb (diff)
commands: Make the error handling for the mod commands more lenient
So it at least is possible to do a `hugo mod clean --all` if the cache is in a funky state.
Diffstat (limited to 'commands/commandeer.go')
-rw-r--r--commands/commandeer.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/commands/commandeer.go b/commands/commandeer.go
index 349838a7e..7706360ab 100644
--- a/commands/commandeer.go
+++ b/commands/commandeer.go
@@ -323,8 +323,11 @@ func (c *commandeer) loadConfig() error {
// We should improve the error handling here,
// but with hugo mod init and similar there is a chicken and egg situation
// with modules already configured in config.toml, so ignore those errors.
- if c.mustHaveConfigFile || !moduleNotFoundRe.MatchString(err.Error()) {
+ if c.mustHaveConfigFile || (c.failOnInitErr && !moduleNotFoundRe.MatchString(err.Error())) {
return err
+ } else {
+ // Just make it a warning.
+ c.logger.Warnln(err)
}
} else if c.mustHaveConfigFile && len(configFiles) == 0 {
return hugolib.ErrNoConfigFile