Mercurial > gemma
changeset 5363:04b3fb35910c extented-report
XLSX templater: More logging in case of expression eval errors.
Break over long lines.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 22 Jun 2021 21:58:28 +0200 |
parents | f733bb327b9b |
children | 1adbd6a5f849 |
files | pkg/xlsx/templater.go |
diffstat | 1 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/xlsx/templater.go Tue Jun 22 18:14:08 2021 +0200 +++ b/pkg/xlsx/templater.go Tue Jun 22 21:58:28 2021 +0200 @@ -566,7 +566,10 @@ return vars } -func (e *executor) expand(str string, vars map[string]interface{}) (string, error) { +func (e *executor) expand( + str string, + vars map[string]interface{}, +) (string, error) { var err error @@ -589,7 +592,10 @@ return str, err } -func (e *executor) typedExpand(str string, vars map[string]interface{}) (interface{}, error) { +func (e *executor) typedExpand( + str string, + vars map[string]interface{}, +) (interface{}, error) { var ( err error @@ -607,6 +613,9 @@ } repCount++ last, err = eval(e.ctx, vars) + if err != nil { + log.Printf("error: '%s' '%s' %v\n", str, s, err) + } return fmt.Sprintf("%v", last) } @@ -616,7 +625,9 @@ return nil, err } - if repCount == 1 && strings.HasPrefix(str, "{{") && strings.HasSuffix(str, "}}") { + if repCount == 1 && + strings.HasPrefix(str, "{{") && + strings.HasSuffix(str, "}}") { return last, nil } return nstr, nil