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

Function WrapCodef

errors/gerror/gerror_api_code.go:71–82  ·  view source on GitHub ↗

WrapCodef wraps error with code and format specifier. It returns nil if given `err` is nil.

(code gcode.Code, err error, format string, args ...any)

Source from the content-addressed store, hash-verified

69// WrapCodef wraps error with code and format specifier.
70// It returns nil if given `err` is nil.
71func WrapCodef(code gcode.Code, err error, format string, args ...any) error {
72 if err == nil {
73 return nil
74 }
75 return &Error{
76 error: err,
77 stack: callers(),
78 text: format,
79 args: args,
80 code: code,
81 }
82}
83
84// WrapCodeSkip wraps error with code and text.
85// It returns nil if given err is nil.

Callers 15

OpenMethod · 0.92
OpenMethod · 0.92
OpenMethod · 0.92
configNodeToSourceFunction · 0.92
OpenMethod · 0.92
OpenMethod · 0.92
configNodeToSourceFunction · 0.92
OpenMethod · 0.92
OpenMethod · 0.92
configNodeToSourceFunction · 0.92
OpenMethod · 0.92
OpenMethod · 0.92

Calls 1

callersFunction · 0.85

Tested by 5

ExampleWrapCodefFunction · 0.74
Test_CodeFunction · 0.74
Benchmark_WrapCodefFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…