]> source.dussan.org Git - gitea.git/commit
Improve template error reporting (#23396) (#23600)
authorGiteabot <teabot@gitea.io>
Mon, 20 Mar 2023 21:53:45 +0000 (17:53 -0400)
committerGitHub <noreply@github.com>
Mon, 20 Mar 2023 21:53:45 +0000 (17:53 -0400)
commita3b917151cedfec5adecdaed777547721a61b930
tree9146e95828d9567e41fad1573dedf2f9f0fed7b4
parent0732ba32ee9e9d0677a58469d0cf290ec8d5d1c5
Improve template error reporting (#23396) (#23600)

Backport #23396 by @zeripath

There are multiple duplicate reports of errors during template rendering
due to broken custom templates.

Unfortunately the error returned here is somewhat difficult for users to
understand and it doesn't return the context of the error.

This PR attempts to parse the error returned by the template renderer to
add in some further context including the filename of the template AND
the preceding lines within that template file.

Ref #23274

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
modules/context/context.go
modules/templates/htmlrenderer.go