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

Side by Side Diff: common/errors/markederror.go

Issue 1249933002: Move multierror logic into luci-go. (Closed) Base URL: https://github.com/luci/luci-go@add_mathrand
Patch Set: rename Created 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package errors 5 package errors
6 6
7 import ( 7 import (
8 "errors"
8 "fmt" 9 "fmt"
9 "path/filepath" 10 "path/filepath"
10 "runtime" 11 "runtime"
11 ) 12 )
12 13
14 // New is a pass-through version of the standard errors.New function.
15 var New = errors.New
16
13 // MarkedError is the specific error type retuned by MakeMarkFn. It's designed 17 // MarkedError is the specific error type retuned by MakeMarkFn. It's designed
14 // so that you can access the underlying object if needed. 18 // so that you can access the underlying object if needed.
15 type MarkedError struct { 19 type MarkedError struct {
16 // Orig contains the original data (error or otherwise) which was passed to 20 // Orig contains the original data (error or otherwise) which was passed to
17 // the marker function. 21 // the marker function.
18 Orig interface{} 22 Orig interface{}
19 23
20 msgFmt string 24 msgFmt string
21 } 25 }
22 26
(...skipping 12 matching lines...) Expand all
35 return nil 39 return nil
36 } 40 }
37 _, filename, line, gotInfo := runtime.Caller(1) 41 _, filename, line, gotInfo := runtime.Caller(1)
38 pfx := fmtstring2 42 pfx := fmtstring2
39 if gotInfo { 43 if gotInfo {
40 pfx = fmt.Sprintf(fmtstring1, filepath.Base(filename), l ine) 44 pfx = fmt.Sprintf(fmtstring1, filepath.Base(filename), l ine)
41 } 45 }
42 return &MarkedError{errish, pfx} 46 return &MarkedError{errish, pfx}
43 } 47 }
44 } 48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698