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

Function WrapCode

errors/gerror/gerror_api_code.go:57–67  ·  view source on GitHub ↗

WrapCode wraps error with code and text. It returns nil if given err is nil.

(code gcode.Code, err error, text ...string)

Source from the content-addressed store, hash-verified

55// WrapCode wraps error with code and text.
56// It returns nil if given err is nil.
57func WrapCode(code gcode.Code, err error, text ...string) error {
58 if err == nil {
59 return nil
60 }
61 return &Error{
62 error: err,
63 stack: callers(),
64 text: strings.Join(text, commaSeparatorSpace),
65 code: code,
66 }
67}
68
69// WrapCodef wraps error with code and format specifier.
70// It returns nil if given `err` is nil.

Callers 15

newWatcherFunction · 0.92
doMergeInsertMethod · 0.92
doMergeInsertMethod · 0.92
doMergeInsertMethod · 0.92
DoExecMethod · 0.92
doMergeInsertMethod · 0.92
DoInsertMethod · 0.92
RegisterCallbackMethod · 0.92
newProviderFunction · 0.92
UnaryRecoverMethod · 0.92
EncryptFunction · 0.92
DecryptFunction · 0.92

Calls 2

callersFunction · 0.85
JoinMethod · 0.45

Tested by 6

ExampleWrapCodeFunction · 0.74
Test_CodeFunction · 0.74
Test_HasCodeFunction · 0.74
Benchmark_WrapCodeFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…