-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack_fixtures_test.go
More file actions
56 lines (43 loc) · 873 Bytes
/
stack_fixtures_test.go
File metadata and controls
56 lines (43 loc) · 873 Bytes
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
package wrapperr_test
import (
"github.com/dc0d/wrapperr"
)
func fn1() error {
return wrapperr.WithStack(errRootCause)
}
func fn2() error {
return fn1()
}
func fn3() error {
return wrapperr.WithStack(errRootCause, "message 3")
}
func fn4() error {
return fn3()
}
func fn5() error {
return wrapperr.WithStack(fn4(), "message 5")
}
func fn6() error {
return fn5()
}
func fn7() error {
return fn3()
}
func fn8() error {
return wrapperr.WithStack(fn7(), emptyAnnotation)
}
func fn9() error {
return fn8()
}
func fn10() error {
return wrapperr.WithStack(fn7(), message1, message2, message3)
}
func fn11() error {
sampleError := sampleErr{Data1: "data 1", Data2: "data 2"}
return wrapperr.WithStackf(sampleError, "the cause is a special error of type %T", sampleError)
}
const (
message1 = "message 1"
message2 = "message 2"
message3 = "message 3"
)