Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-10-21 12:17:48 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-10-22 10:09:29 +0300
commitfdfa4a5fe62232f65f1dd8d6fe0c500374228788 (patch)
treeb804e91506a7f3c58690c6fd774b28f95184d5dc /deps
parent8cbe2bbfad6aa4de267921e24e166d4addf47040 (diff)
Allow getJSON errors to be ignored
This change is mostly motivated to get a more stable CI build (we're building the Hugo site there, with Instagram and Twitter shortcodes sometimes failing). Fixes #7866
Diffstat (limited to 'deps')
-rw-r--r--deps/deps.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/deps/deps.go b/deps/deps.go
index cfd39bf7d..b70dcb5a0 100644
--- a/deps/deps.go
+++ b/deps/deps.go
@@ -21,6 +21,7 @@ import (
"github.com/gohugoio/hugo/resources"
"github.com/gohugoio/hugo/source"
"github.com/gohugoio/hugo/tpl"
+ "github.com/spf13/cast"
jww "github.com/spf13/jwalterweatherman"
)
@@ -30,7 +31,7 @@ import (
type Deps struct {
// The logger to use.
- Log *loggers.Logger `json:"-"`
+ Log loggers.Logger `json:"-"`
// Used to log errors that may repeat itself many times.
DistinctErrorLog *helpers.DistinctLogger
@@ -260,12 +261,15 @@ func New(cfg DepsCfg) (*Deps, error) {
timeoutms = 3000
}
- distinctErrorLogger := helpers.NewDistinctLogger(logger.ERROR)
- distinctWarnLogger := helpers.NewDistinctLogger(logger.WARN)
+ ignoreErrors := cast.ToStringSlice(cfg.Cfg.Get("ignoreErrors"))
+ ignorableLogger := loggers.NewIgnorableLogger(logger, ignoreErrors...)
+
+ distinctErrorLogger := helpers.NewDistinctLogger(logger.Error())
+ distinctWarnLogger := helpers.NewDistinctLogger(logger.Warn())
d := &Deps{
Fs: fs,
- Log: logger,
+ Log: ignorableLogger,
DistinctErrorLog: distinctErrorLogger,
DistinctWarningLog: distinctWarnLogger,
templateProvider: cfg.TemplateProvider,
@@ -350,7 +354,7 @@ func (d Deps) ForLanguage(cfg DepsCfg, onCreated func(d *Deps) error) (*Deps, er
type DepsCfg struct {
// The Logger to use.
- Logger *loggers.Logger
+ Logger loggers.Logger
// The file systems to use
Fs *hugofs.Fs