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

Issue 5026041: code review 5026041: exp/template/html: moved error docs out of package docs... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 8 months ago by MikeSamuel
Modified:
12 years, 8 months ago
Reviewers:
CC:
r, nigeltao, golang-dev
Visibility:
Public.

Description

exp/template/html: moved error docs out of package docs onto error codes This replaces the errStr & errLine members of context with a single err *Error, and introduces a number of const error codes, one per escape-time failure mode, that can be separately documented. The changes to the error documentation moved from doc.go to error.go are cosmetic.

Patch Set 1 #

Patch Set 2 : diff -r 805742b53bf3 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 805742b53bf3 https://go.googlecode.com/hg/ #

Total comments: 9

Patch Set 4 : diff -r 805742b53bf3 https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r 805742b53bf3 https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r 805742b53bf3 https://go.googlecode.com/hg/ #

Patch Set 7 : diff -r f6df6a0d58e5 https://go.googlecode.com/hg/ #

Total comments: 20

Patch Set 8 : diff -r 2a7e3e5d18bd https://go.googlecode.com/hg/ #

Patch Set 9 : diff -r 2a7e3e5d18bd https://go.googlecode.com/hg/ #

Patch Set 10 : diff -r 2a7e3e5d18bd https://go.googlecode.com/hg/ #

Total comments: 6

Patch Set 11 : diff -r 55bd1a6742c3 https://go.googlecode.com/hg/ #

Total comments: 10

Patch Set 12 : diff -r 0eaf2652c608 https://go.googlecode.com/hg/ #

Patch Set 13 : diff -r 0eaf2652c608 https://go.googlecode.com/hg/ #

Patch Set 14 : diff -r 0eaf2652c608 https://go.googlecode.com/hg/ #

Patch Set 15 : diff -r 0eaf2652c608 https://go.googlecode.com/hg/ #

Patch Set 16 : diff -r 0eaf2652c608 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+235 lines, -218 lines) Patch
M src/pkg/exp/template/html/Makefile View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M src/pkg/exp/template/html/context.go View 1 2 3 4 2 chunks +2 lines, -4 lines 0 comments Download
M src/pkg/exp/template/html/doc.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +1 line, -173 lines 0 comments Download
A src/pkg/exp/template/html/error.go View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +194 lines, -0 lines 0 comments Download
M src/pkg/exp/template/html/escape.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 8 chunks +15 lines, -20 lines 0 comments Download
M src/pkg/exp/template/html/escape_test.go View 1 2 3 4 5 6 7 4 chunks +5 lines, -5 lines 0 comments Download
M src/pkg/exp/template/html/transition.go View 1 2 3 4 5 6 7 9 chunks +17 lines, -16 lines 0 comments Download

Messages

Total messages: 16
MikeSamuel
Hello r@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
12 years, 8 months ago (2011-09-15 00:50:33 UTC) #1
r
http://codereview.appspot.com/5026041/diff/5001/src/pkg/exp/template/html/error.go File src/pkg/exp/template/html/error.go (right): http://codereview.appspot.com/5026041/diff/5001/src/pkg/exp/template/html/error.go#newcode35 src/pkg/exp/template/html/error.go:35: // it from filtering. i filed a bug with ...
12 years, 8 months ago (2011-09-15 01:03:45 UTC) #2
nigeltao
I think that the ErrXxx types need to be a non-interface type (i.e. a struct ...
12 years, 8 months ago (2011-09-15 01:33:31 UTC) #3
r
http://codereview.appspot.com/5026041/diff/5001/src/pkg/exp/template/html/error.go File src/pkg/exp/template/html/error.go (right): http://codereview.appspot.com/5026041/diff/5001/src/pkg/exp/template/html/error.go#newcode105 src/pkg/exp/template/html/error.go:105: ErrBranchEnd os.Error ack! yes. i missed this, conflating these ...
12 years, 8 months ago (2011-09-15 01:43:11 UTC) #4
nigeltao
A broader question is why are these errors separate types? It's not like a user ...
12 years, 8 months ago (2011-09-15 01:44:03 UTC) #5
nigeltao
One possibility is type Error struct { ErrorCode ErrorCode Line int Detail string } func ...
12 years, 8 months ago (2011-09-15 01:50:05 UTC) #6
MikeSamuel
On 2011/09/15 01:50:05, nigeltao wrote: > One possibility is > > type Error struct { ...
12 years, 8 months ago (2011-09-15 01:54:43 UTC) #7
MikeSamuel
On 2011/09/15 01:50:05, nigeltao wrote: > One possibility is > > type Error struct { ...
12 years, 8 months ago (2011-09-15 02:17:47 UTC) #8
MikeSamuel
> Done. ErrorCode is called ErrorKind because I saw that name in another package > ...
12 years, 8 months ago (2011-09-15 03:17:38 UTC) #9
nigeltao
http://codereview.appspot.com/5026041/diff/15003/src/pkg/exp/template/html/error.go File src/pkg/exp/template/html/error.go (right): http://codereview.appspot.com/5026041/diff/15003/src/pkg/exp/template/html/error.go#newcode20 src/pkg/exp/template/html/error.go:20: s string You might as well export all the ...
12 years, 8 months ago (2011-09-15 08:28:42 UTC) #10
r
http://codereview.appspot.com/5026041/diff/15003/src/pkg/exp/template/html/doc.go File src/pkg/exp/template/html/doc.go (right): http://codereview.appspot.com/5026041/diff/15003/src/pkg/exp/template/html/doc.go#newcode72 src/pkg/exp/template/html/doc.go:72: Source file error.go contains error types and each type's ...
12 years, 8 months ago (2011-09-15 13:02:10 UTC) #11
MikeSamuel
http://codereview.appspot.com/5026041/diff/15003/src/pkg/exp/template/html/doc.go File src/pkg/exp/template/html/doc.go (right): http://codereview.appspot.com/5026041/diff/15003/src/pkg/exp/template/html/doc.go#newcode72 src/pkg/exp/template/html/doc.go:72: Source file error.go contains error types and each type's ...
12 years, 8 months ago (2011-09-15 15:59:53 UTC) #12
r
LGTM leaving for nigeltao http://codereview.appspot.com/5026041/diff/11003/src/pkg/exp/template/html/doc.go File src/pkg/exp/template/html/doc.go (right): http://codereview.appspot.com/5026041/diff/11003/src/pkg/exp/template/html/doc.go#newcode73 src/pkg/exp/template/html/doc.go:73: explanation of the problem. See ...
12 years, 8 months ago (2011-09-15 19:33:14 UTC) #13
MikeSamuel
Incremental diffs at http://codereview.appspot.com/5026041/diff2/11003:28001/src/pkg/exp/template/html/doc.go http://codereview.appspot.com/5026041/diff/11003/src/pkg/exp/template/html/doc.go File src/pkg/exp/template/html/doc.go (right): http://codereview.appspot.com/5026041/diff/11003/src/pkg/exp/template/html/doc.go#newcode73 src/pkg/exp/template/html/doc.go:73: explanation of the problem. On ...
12 years, 8 months ago (2011-09-15 20:13:49 UTC) #14
nigeltao
LGTM. http://codereview.appspot.com/5026041/diff/28001/src/pkg/exp/template/html/error.go File src/pkg/exp/template/html/error.go (right): http://codereview.appspot.com/5026041/diff/28001/src/pkg/exp/template/html/error.go#newcode26 src/pkg/exp/template/html/error.go:26: // We define types for each error that ...
12 years, 8 months ago (2011-09-16 00:46:18 UTC) #15
MikeSamuel
12 years, 8 months ago (2011-09-16 02:05:40 UTC) #16
*** Submitted as http://code.google.com/p/go/source/detail?r=5381c9668045 ***

exp/template/html: moved error docs out of package docs onto error codes

This replaces the errStr & errLine members of context with a single err
*Error, and introduces a number of const error codes, one per
escape-time failure mode, that can be separately documented.

The changes to the error documentation moved from doc.go to error.go
are cosmetic.

R=r, nigeltao
CC=golang-dev
http://codereview.appspot.com/5026041

http://codereview.appspot.com/5026041/diff/28001/src/pkg/exp/template/html/er...
File src/pkg/exp/template/html/error.go (right):

http://codereview.appspot.com/5026041/diff/28001/src/pkg/exp/template/html/er...
src/pkg/exp/template/html/error.go:26: // We define types for each error that
manifests while escaping templates, but
On 2011/09/16 00:46:18, nigeltao wrote:
> s/types/codes/.

Done.

http://codereview.appspot.com/5026041/diff/28001/src/pkg/exp/template/html/er...
src/pkg/exp/template/html/error.go:29: // Error: "ZgotmplZ"
On 2011/09/16 00:46:18, nigeltao wrote:
> This isn't really an error, though, in that html.EscapeSet will return a nil
> os.Error. Maybe reword this section so that that's clearer. I might take a
crack
> at that in a separate CL.

Reworded.

http://codereview.appspot.com/5026041/diff/28001/src/pkg/exp/template/html/er...
src/pkg/exp/template/html/error.go:143: // Error: "unfinished JS regexp charset
in ..."
On 2011/09/16 00:46:18, nigeltao wrote:
> s/Error/ErrPartialCharset/. Similarly at line 151.

Done.

http://codereview.appspot.com/5026041/diff/28001/src/pkg/exp/template/html/es...
File src/pkg/exp/template/html/escape.go (right):

http://codereview.appspot.com/5026041/diff/28001/src/pkg/exp/template/html/es...
src/pkg/exp/template/html/escape.go:292: func (e *escaper) join(a, b context,
line int, nodeName string) context {
On 2011/09/16 00:46:18, nigeltao wrote:
> join no longer needs to be a method of escaper.

Done.

http://codereview.appspot.com/5026041/diff/28001/src/pkg/exp/template/html/es...
src/pkg/exp/template/html/escape.go:340: c0.err.Description, c0.err.Line =
fmt.Sprintf("on range loop re-entry: %s", c0.err.Description), n.Line
On 2011/09/16 00:46:18, nigeltao wrote:
> I'd split these two assignments over two lines.

Done.
Sign in to reply to this message.

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