Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Side by Side Diff: deploytool/api/deploy/util.go

Issue 2963503003: [errors] Greatly simplify common/errors package. (Closed)
Patch Set: fix nits Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « common/tsmon/iface.go ('k') | deploytool/cmd/luci_deploy/appengine.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package deploy 5 package deploy
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "strings" 9 "strings"
10 "time" 10 "time"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // If the direction value is not recognized, an error will be returned. 149 // If the direction value is not recognized, an error will be returned.
150 func IndexDirectionFromAppYAMLString(v string) (AppEngineResources_Index_Directi on, error) { 150 func IndexDirectionFromAppYAMLString(v string) (AppEngineResources_Index_Directi on, error) {
151 switch v { 151 switch v {
152 case "asc", "": 152 case "asc", "":
153 return AppEngineResources_Index_ASCENDING, nil 153 return AppEngineResources_Index_ASCENDING, nil
154 154
155 case "desc": 155 case "desc":
156 return AppEngineResources_Index_DESCENDING, nil 156 return AppEngineResources_Index_DESCENDING, nil
157 157
158 default: 158 default:
159 » » return 0, errors.Reason("invalid index direction %(value)q").D(" value", v).Err() 159 » » return 0, errors.Reason("invalid index direction %q", v).Err()
160 } 160 }
161 } 161 }
162 162
163 // KubeString returns the Kubernetes "restartPolicy" field string for the 163 // KubeString returns the Kubernetes "restartPolicy" field string for the
164 // enumeration value. 164 // enumeration value.
165 func (v KubernetesPod_RestartPolicy) KubeString() string { 165 func (v KubernetesPod_RestartPolicy) KubeString() string {
166 switch v { 166 switch v {
167 case KubernetesPod_RESTART_ALWAYS: 167 case KubernetesPod_RESTART_ALWAYS:
168 return "Always" 168 return "Always"
169 case KubernetesPod_RESTART_ON_FAILURE: 169 case KubernetesPod_RESTART_ON_FAILURE:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 return "Ti" 205 return "Ti"
206 case KubernetesPod_Container_Resources_PEBIBYTE: 206 case KubernetesPod_Container_Resources_PEBIBYTE:
207 return "Pi" 207 return "Pi"
208 case KubernetesPod_Container_Resources_EXBIBYTE: 208 case KubernetesPod_Container_Resources_EXBIBYTE:
209 return "Ei" 209 return "Ei"
210 210
211 default: 211 default:
212 panic(fmt.Errorf("unknown resource unit (%v)", v)) 212 panic(fmt.Errorf("unknown resource unit (%v)", v))
213 } 213 }
214 } 214 }
OLDNEW
« no previous file with comments | « common/tsmon/iface.go ('k') | deploytool/cmd/luci_deploy/appengine.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698