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

Function ExampleCode

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

Source from the content-addressed store, hash-verified

84}
85
86func ExampleCode() {
87 err1 := gerror.NewCode(gcode.CodeInternalError, "permission denied")
88 err2 := gerror.Wrap(err1, "operation failed")
89 fmt.Println(gerror.Code(err1))
90 fmt.Println(gerror.Code(err2))
91
92 // Output:
93 // 50:Internal Error
94 // 50:Internal Error
95}
96
97func ExampleHasCode() {
98 err1 := gerror.NewCode(gcode.CodeInternalError, "permission denied")

Callers

nothing calls this directly

Calls 3

NewCodeFunction · 0.92
WrapFunction · 0.92
CodeFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…