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

Side by Side Diff: dashboard/app/build/handler.go

Issue 153070043: code review 153070043: go.tools/dashboard/app: return specific error string on... (Closed)
Patch Set: diff -r 0732e60486ac68f13059ec7d805e6c086299bb0a https://code.google.com/p/go.tools Created 10 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // +build appengine 5 // +build appengine
6 6
7 package build 7 package build
8 8
9 import ( 9 import (
10 "bytes" 10 "bytes"
(...skipping 29 matching lines...) Expand all
40 // 40 //
41 // This handler is used by a gobuilder process in -commit mode. 41 // This handler is used by a gobuilder process in -commit mode.
42 func commitHandler(r *http.Request) (interface{}, error) { 42 func commitHandler(r *http.Request) (interface{}, error) {
43 c := contextForRequest(r) 43 c := contextForRequest(r)
44 com := new(Commit) 44 com := new(Commit)
45 45
46 if r.Method == "GET" { 46 if r.Method == "GET" {
47 com.PackagePath = r.FormValue("packagePath") 47 com.PackagePath = r.FormValue("packagePath")
48 com.Hash = r.FormValue("hash") 48 com.Hash = r.FormValue("hash")
49 if err := datastore.Get(c, com.Key(c), com); err != nil { 49 if err := datastore.Get(c, com.Key(c), com); err != nil {
50 if err == datastore.ErrNoSuchEntity {
51 return nil, errors.New("Commit not found")
52 }
50 return nil, fmt.Errorf("getting Commit: %v", err) 53 return nil, fmt.Errorf("getting Commit: %v", err)
51 } 54 }
52 if com.Num == 0 { 55 if com.Num == 0 {
53 // Corrupt state which shouldn't happen but does. 56 // Corrupt state which shouldn't happen but does.
54 // Return an error so builders' commit loops will 57 // Return an error so builders' commit loops will
55 // be willing to retry submitting this commit. 58 // be willing to retry submitting this commit.
56 return nil, errors.New("in datastore with zero Num") 59 return nil, errors.New("in datastore with zero Num")
57 } 60 }
58 if com.Desc == "" || com.User == "" { 61 if com.Desc == "" || com.User == "" {
59 // Also shouldn't happen, but at least happened 62 // Also shouldn't happen, but at least happened
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 } 886 }
884 for { 887 for {
885 s = s[:max] 888 s = s[:max]
886 r, size := utf8.DecodeLastRuneInString(s) 889 r, size := utf8.DecodeLastRuneInString(s)
887 if r != utf8.RuneError || size != 1 { 890 if r != utf8.RuneError || size != 1 {
888 return s 891 return s
889 } 892 }
890 max-- 893 max--
891 } 894 }
892 } 895 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

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