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

Side by Side Diff: logdog/client/butlerlib/bootstrap/bootstrap.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 | « logdog/client/butler/streamserver/tcp.go ('k') | logdog/client/butlerlib/streamclient/tcp.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 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 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 bootstrap 5 package bootstrap
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 9
10 "github.com/luci/luci-go/client/environ" 10 "github.com/luci/luci-go/client/environ"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return nil, fmt.Errorf("bootstrap: failed to create stre am client [%s]: %s", p, err) 67 return nil, fmt.Errorf("bootstrap: failed to create stre am client [%s]: %s", p, err)
68 } 68 }
69 } 69 }
70 70
71 return bs, nil 71 return bs, nil
72 } 72 }
73 73
74 func (bs *Bootstrap) initializeClient(v string, reg *streamclient.Registry) erro r { 74 func (bs *Bootstrap) initializeClient(v string, reg *streamclient.Registry) erro r {
75 c, err := reg.NewClient(v) 75 c, err := reg.NewClient(v)
76 if err != nil { 76 if err != nil {
77 » » return errors.Annotate(err).Reason("bootstrap: failed to create stream client [%(config)s]").D("config", v).Err() 77 » » return errors.Annotate(err, "bootstrap: failed to create stream client [%s]", v).Err()
78 } 78 }
79 bs.Client = c 79 bs.Client = c
80 return nil 80 return nil
81 } 81 }
82 82
83 // Get loads a Bootstrap instance from the environment. It will return an error 83 // Get loads a Bootstrap instance from the environment. It will return an error
84 // if the bootstrap data is invalid, and will return ErrNotBootstrapped if the 84 // if the bootstrap data is invalid, and will return ErrNotBootstrapped if the
85 // current process is not bootstrapped. 85 // current process is not bootstrapped.
86 func Get() (*Bootstrap, error) { 86 func Get() (*Bootstrap, error) {
87 return getFromEnv(environ.Get(), streamclient.GetDefaultRegistry()) 87 return getFromEnv(environ.Get(), streamclient.GetDefaultRegistry())
(...skipping 23 matching lines...) Expand all
111 if bs.Prefix == "" { 111 if bs.Prefix == "" {
112 return "", errors.New("no prefix is configured") 112 return "", errors.New("no prefix is configured")
113 } 113 }
114 114
115 paths := make([]types.StreamPath, len(streams)) 115 paths := make([]types.StreamPath, len(streams))
116 for i, s := range streams { 116 for i, s := range streams {
117 paths[i] = bs.Prefix.Join(types.StreamName(s.Properties().Name)) 117 paths[i] = bs.Prefix.Join(types.StreamName(s.Properties().Name))
118 } 118 }
119 return bs.GetViewerURL(paths...) 119 return bs.GetViewerURL(paths...)
120 } 120 }
OLDNEW
« no previous file with comments | « logdog/client/butler/streamserver/tcp.go ('k') | logdog/client/butlerlib/streamclient/tcp.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698