]> Cypherpunks repositories - gostls13.git/commit
template: better error message for empty templates
authorRob Pike <r@golang.org>
Tue, 20 Dec 2011 20:58:23 +0000 (12:58 -0800)
committerRob Pike <r@golang.org>
Tue, 20 Dec 2011 20:58:23 +0000 (12:58 -0800)
commit4869996b928d0e5dc978a4de31f2824b47ae8cb7
treec85d515fc17c6b37cbcec281af3f8a7b06db9216
parentbbdd2070a92adedaa60e91cc14791daf01ba8deb
template: better error message for empty templates
New("x").ParseFiles("y") can result in an empty "x" template.
Make the message clearer that this is the problem. The error
returns from both template packages in this case were
confusing.

I considered making the method use "x" instead of "y" in
this case, but that just made other situations confusing
and harder to explain.

Fixes #2594.

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/5498048
src/pkg/html/template/escape.go
src/pkg/html/template/escape_test.go
src/pkg/text/template/exec.go