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
This commit is contained in:
Bjørn Erik Pedersen
2020-10-21 11:17:48 +02:00
parent 8cbe2bbfad
commit fdfa4a5fe6
52 changed files with 318 additions and 221 deletions

View File

@@ -23,6 +23,9 @@ import (
"net/http"
"strings"
"github.com/gohugoio/hugo/common/constants"
"github.com/gohugoio/hugo/common/loggers"
"github.com/spf13/cast"
"github.com/gohugoio/hugo/cache/filecache"
@@ -85,7 +88,7 @@ func (ns *Namespace) GetCSV(sep string, urlParts ...interface{}) (d [][]string,
err = ns.getResource(cache, unmarshal, req)
if err != nil {
ns.deps.Log.ERROR.Printf("Failed to get CSV resource %q: %s", url, err)
ns.deps.Log.(loggers.IgnorableLogger).Errorsf(constants.ErrRemoteGetCSV, "Failed to get CSV resource %q: %s", url, err)
return nil, nil
}
@@ -117,7 +120,7 @@ func (ns *Namespace) GetJSON(urlParts ...interface{}) (interface{}, error) {
err = ns.getResource(cache, unmarshal, req)
if err != nil {
ns.deps.Log.ERROR.Printf("Failed to get JSON resource %q: %s", url, err)
ns.deps.Log.(loggers.IgnorableLogger).Errorsf(constants.ErrRemoteGetJSON, "Failed to get JSON resource %q: %s", url, err)
return nil, nil
}