URI: 
       tpl/data: Prevent getJSON and getCSV fetch failure from aborting build - hugo - [fork] hugo port for 9front
  HTML git clone git@git.drkhsh.at/hugo.git
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit 6a2bfcbec8df14b1741dbe9b5ead08158bf7adb9
   DIR parent 59d87044a4146f578b92b3d67b46660212940912
  HTML Author: Anthony Fok <foka@debian.org>
       Date:   Mon, 28 Jan 2019 16:27:43 -0700
       
       tpl/data: Prevent getJSON and getCSV fetch failure from aborting build
       
       Fixes #5643
       
       Diffstat:
         M tpl/data/data.go                    |      10 +++++-----
       
       1 file changed, 5 insertions(+), 5 deletions(-)
       ---
   DIR diff --git a/tpl/data/data.go b/tpl/data/data.go
       @@ -83,7 +83,8 @@ func (ns *Namespace) GetCSV(sep string, urlParts ...string) (d [][]string, err e
        
                err = ns.getResource(cache, unmarshal, req)
                if err != nil {
       -                return nil, _errors.Wrapf(err, "failed to read CSV resource %q", url)
       +                ns.deps.Log.ERROR.Printf("Failed to get CSV resource %q: %s", url, err)
       +                return nil, nil
                }
        
                return
       @@ -113,19 +114,18 @@ func (ns *Namespace) GetJSON(urlParts ...string) (interface{}, error) {
                req.Header.Add("Accept", "application/json")
        
                err = ns.getResource(cache, unmarshal, req)
       -
                if err != nil {
       -                return nil, _errors.Wrapf(err, "failed to get getJSON resource %q", url)
       +                ns.deps.Log.ERROR.Printf("Failed to get JSON resource %q: %s", url, err)
       +                return nil, nil
                }
        
                return v, nil
       -
        }
        
        // parseCSV parses bytes of CSV data into a slice slice string or an error
        func parseCSV(c []byte, sep string) ([][]string, error) {
                if len(sep) != 1 {
       -                return nil, errors.New("Incorrect length of csv separator: " + sep)
       +                return nil, errors.New("Incorrect length of CSV separator: " + sep)
                }
                b := bytes.NewReader(c)
                r := csv.NewReader(b)