MCPcopy Index your code
hub / github.com/gogf/gf / ExampleWrapCode

Function ExampleWrapCode

errors/gerror/gerror_z_example_test.go:37–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35}
36
37func ExampleWrapCode() {
38 err1 := errors.New("permission denied")
39 err2 := gerror.WrapCode(gcode.New(10000, "", nil), err1, "Custom Error")
40 fmt.Println(err2.Error())
41 fmt.Println(gerror.Code(err2).Code())
42
43 // Output:
44 // Custom Error: permission denied
45 // 10000
46}
47
48func ExampleWrapCodef() {
49 err1 := errors.New("permission denied")

Callers

nothing calls this directly

Calls 6

WrapCodeFunction · 0.92
NewFunction · 0.92
CodeFunction · 0.92
NewMethod · 0.65
ErrorMethod · 0.65
CodeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…