tpl/data: Revise error handling in getJSON and getCSV

The most important part being: Log ERROR, but do not stop the build on remote errors.

Fixes #5076
This commit is contained in:
Bjørn Erik Pedersen
2018-09-10 21:02:18 +02:00
parent 4f72e79120
commit 43d446522a
3 changed files with 56 additions and 28 deletions

View File

@@ -23,6 +23,7 @@ import (
"testing"
"time"
"github.com/gohugoio/hugo/common/loggers"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/deps"
"github.com/gohugoio/hugo/helpers"
@@ -171,10 +172,15 @@ func newDeps(cfg config.Provider) *deps.Deps {
if err != nil {
panic(err)
}
logger := loggers.NewErrorLogger()
return &deps.Deps{
Cfg: cfg,
Fs: hugofs.NewMem(l),
ContentSpec: cs,
Cfg: cfg,
Fs: hugofs.NewMem(l),
ContentSpec: cs,
Log: logger,
DistinctErrorLog: helpers.NewDistinctLogger(logger.ERROR),
}
}