File tree Expand file tree Collapse file tree 2 files changed +4
-20
lines changed Expand file tree Collapse file tree 2 files changed +4
-20
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ func (c Chain) Error() string {
3434 lines := make ([]string , 0 , len (c ))
3535 // source=<source> <prefix>: <error> tag=value tag2=value2 types=type1,type2
3636 for i := len (c ) - 1 ; i >= 0 ; i -- {
37- line := c [i ].Error ()
37+ line := c [i ].formatError ()
3838 lines = append (lines , line )
3939 }
4040 return strings .Join (lines , "\n " )
@@ -60,17 +60,15 @@ type Link struct {
6060 Source string
6161}
6262
63- // Error prints a single Links error
64- func (l * Link ) Error () string {
63+ // formatError prints a single Links error
64+ func (l * Link ) formatError () string {
6565 line := fmt .Sprintf ("source=%s " , l .Source )
6666
6767 if l .Prefix != "" {
6868 line += l .Prefix + ": "
6969 }
7070
71- if _ , isLink := l .Err .(* Link ); ! isLink {
72- line += l .Err .Error ()
73- }
71+ line += l .Err .Error ()
7472
7573 for _ , tag := range l .Tags {
7674 line += fmt .Sprintf (" %s=%v" , tag .Key , tag .Value )
Original file line number Diff line number Diff line change @@ -46,8 +46,6 @@ func Cause(err error) error {
4646 switch t := err .(type ) {
4747 case Chain :
4848 return t [0 ].Err
49- case * Link :
50- return t .Err
5149 default :
5250 return err
5351 }
@@ -66,12 +64,6 @@ func HasType(err error, typ string) bool {
6664 }
6765 }
6866 }
69- case * Link :
70- for i := 0 ; i < len (t .Types ); i ++ {
71- if t .Types [i ] == typ {
72- return true
73- }
74- }
7567 }
7668 return false
7769}
@@ -87,12 +79,6 @@ func LookupTag(err error, key string) interface{} {
8779 }
8880 }
8981 }
90- case * Link :
91- for i := 0 ; i < len (t .Tags ); i ++ {
92- if t .Tags [i ].Key == key {
93- return t .Tags [i ].Value
94- }
95- }
9682 }
9783 return nil
9884}
You can’t perform that action at this time.
0 commit comments