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

Side by Side Diff: vpython/venv/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 | « vpython/venv/system_windows.go ('k') | vpython/venv/venv.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 2017 The LUCI Authors. All rights reserved. 1 // Copyright 2017 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 venv 5 package venv
6 6
7 import ( 7 import (
8 "os" 8 "os"
9 9
10 "github.com/golang/protobuf/proto" 10 "github.com/golang/protobuf/proto"
11 11
12 "github.com/luci/luci-go/common/errors" 12 "github.com/luci/luci-go/common/errors"
13 ) 13 )
14 14
15 func writeTextProto(path string, msg proto.Message) error { 15 func writeTextProto(path string, msg proto.Message) error {
16 fd, err := os.Create(path) 16 fd, err := os.Create(path)
17 if err != nil { 17 if err != nil {
18 » » return errors.Annotate(err).Reason("failed to create output file ").Err() 18 » » return errors.Annotate(err, "failed to create output file").Err( )
19 } 19 }
20 20
21 if err := proto.MarshalText(fd, msg); err != nil { 21 if err := proto.MarshalText(fd, msg); err != nil {
22 _ = fd.Close() 22 _ = fd.Close()
23 » » return errors.Annotate(err).Reason("failed to output text protob uf").Err() 23 » » return errors.Annotate(err, "failed to output text protobuf").Er r()
24 } 24 }
25 25
26 if err := fd.Close(); err != nil { 26 if err := fd.Close(); err != nil {
27 » » return errors.Annotate(err).Reason("failed to Close temporary fi le").Err() 27 » » return errors.Annotate(err, "failed to Close temporary file").Er r()
28 } 28 }
29 29
30 return nil 30 return nil
31 } 31 }
OLDNEW
« no previous file with comments | « vpython/venv/system_windows.go ('k') | vpython/venv/venv.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698