MCPcopy
hub / github.com/duke-git/lancet / ExampleXError_StackTrace

Function ExampleXError_StackTrace

xerror/xerror_example_test.go:52–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50}
51
52func ExampleXError_StackTrace() {
53 err := New("error")
54
55 stacks := err.Stacks()
56
57 fmt.Println(stacks[0].Func)
58 fmt.Println(stacks[0].Line)
59
60 containFile := strings.Contains(stacks[0].File, "xerror_example_test.go")
61 fmt.Println(containFile)
62
63 // Output:
64 // github.com/duke-git/lancet/v2/xerror.ExampleXError_StackTrace
65 // 53
66 // true
67}
68
69func ExampleXError_With() {
70 err := New("error").With("level", "high")

Callers

nothing calls this directly

Calls 3

StacksMethod · 0.80
NewFunction · 0.70
ContainsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…