Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(298)

Issue 5498048: code review 5498048: template: better error message for empty templates (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 5 months ago by r
Modified:
13 years, 5 months ago
Reviewers:
CC:
golang-dev, rsc, r2
Visibility:
Public.

Description

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 issue 2594.

Patch Set 1 #

Patch Set 2 : diff -r e932eb65eeb5 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+11 lines, -3 lines) Patch
M src/pkg/html/template/escape.go View 1 1 chunk +9 lines, -1 line 0 comments Download
M src/pkg/html/template/escape_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/text/template/exec.go View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 7
r
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
13 years, 5 months ago (2011-12-20 19:42:38 UTC) #1
rsc
Test? If I do New("x").Parse("") that's still okay, right?
13 years, 5 months ago (2011-12-20 19:44:10 UTC) #2
r2
On Dec 20, 2011, at 11:44 AM, Russ Cox wrote: > Test? > > If ...
13 years, 5 months ago (2011-12-20 19:45:37 UTC) #3
rsc
On Tue, Dec 20, 2011 at 14:45, Rob 'Commander' Pike <r@google.com> wrote: >> If I ...
13 years, 5 months ago (2011-12-20 19:54:13 UTC) #4
r2
On Dec 20, 2011, at 11:54 AM, Russ Cox wrote: > On Tue, Dec 20, ...
13 years, 5 months ago (2011-12-20 19:56:53 UTC) #5
rsc
LGTM incomplete?
13 years, 5 months ago (2011-12-20 19:57:31 UTC) #6
r
13 years, 5 months ago (2011-12-20 20:58:26 UTC) #7
*** Submitted as d96df215f3b5 ***

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 issue 2594.

R=golang-dev, rsc, r
CC=golang-dev
http://codereview.appspot.com/5498048
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b