MCPcopy
hub / github.com/gogf/gf / ExampleHasCode

Function ExampleHasCode

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

Source from the content-addressed store, hash-verified

95}
96
97func ExampleHasCode() {
98 err1 := gerror.NewCode(gcode.CodeInternalError, "permission denied")
99 err2 := gerror.Wrap(err1, "operation failed")
100 fmt.Println(gerror.HasCode(err1, gcode.CodeOK))
101 fmt.Println(gerror.HasCode(err2, gcode.CodeInternalError))
102
103 // Output:
104 // false
105 // true
106}

Callers

nothing calls this directly

Calls 3

NewCodeFunction · 0.92
WrapFunction · 0.92
HasCodeFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…