forked from pkg/errors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheverybody_errors_test.go
74 lines (58 loc) · 1.5 KB
/
everybody_errors_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package errors
import (
"testing"
)
// 자기 다음이
func Test(t *testing.T){
//t.Errorf("%+v", D())
t.Logf("%+v", GetRootStackError(wrapped()))
t.Log("-----------------------------------------------------")
t.Logf("%+v", GetRootStackError(withStacked()))
t.Log("-----------------------------------------------------")
t.Logf("%+v", GetRootStackError(withMessaged()))
t.Log("-----------------------------------------------------")
t.Logf("%+v", GetRootStackError(mixed1()))
t.Log("-----------------------------------------------------")
t.Logf("%+v", GetRootStackError(mixed2()))
t.Log("-----------------------------------------------------")
t.Logf("%+v", GetRootStackError(G()))
}
func Root()error {
return New("Root")
}
func wrapped() error {
return Wrap(Wrap(Wrap(Root(), "wrapped1"), "wrapped2"), "wrapped3")
}
func withStacked() error{
return WithStack(WithStack(WithStack(Root())))
}
func withMessaged() error{
return WithMessage(WithMessage(WithMessage(Root(), "withMessaged"), "withMessaged2"), "withMessaged3")
}
func mixed1() error{
return WithMessage(WithStack(Wrap(Root(), "wrap")), "withMessage")
}
func mixed2() error{
return Wrap(WithStack(WithMessage(Root(), "wrap")), "withMessage")
}
func A() error{
return New("A")
}
func B() error{
return WithStack(A())
}
func C() error {
return Wrap(B(), "")
}
func D() error{
return WithMessage(C(), "")
}
func E() error{
return WithMessage(D(), "")
}
func F() error{
return Wrap(E(), "")
}
func G() error{
return WithStack(F())
}