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

Function ExampleXError_Info

xerror/xerror_example_test.go:123–139  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121}
122
123func ExampleXError_Info() {
124 cause := errors.New("error")
125 err := Wrap(cause, "invalid username").Id("e001").With("level", "high")
126
127 errInfo := err.Info()
128
129 fmt.Println(errInfo.Id)
130 fmt.Println(errInfo.Cause)
131 fmt.Println(errInfo.Values["level"])
132 fmt.Println(errInfo.Message)
133
134 // Output:
135 // e001
136 // error
137 // high
138 // invalid username
139}
140
141func ExampleTryUnwrap() {
142 result1 := TryUnwrap(strconv.Atoi("42"))

Callers

nothing calls this directly

Calls 5

NewMethod · 0.80
WithMethod · 0.80
IdMethod · 0.80
InfoMethod · 0.80
WrapFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…