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

Function WrapCodeSkipf

errors/gerror/gerror_api_code.go:102–113  ·  view source on GitHub ↗

WrapCodeSkipf wraps error with code and text that is formatted with given format and args. It returns nil if given err is nil. The parameter `skip` specifies the stack callers skipped amount.

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

Source from the content-addressed store, hash-verified

100// It returns nil if given err is nil.
101// The parameter `skip` specifies the stack callers skipped amount.
102func WrapCodeSkipf(code gcode.Code, skip int, err error, format string, args ...any) error {
103 if err == nil {
104 return nil
105 }
106 return &Error{
107 error: err,
108 stack: callers(skip),
109 text: format,
110 args: args,
111 code: code,
112 }
113}
114
115// Code returns the error code of `current error`.
116// It returns `CodeNil` if it has no error code neither it does not implement interface Code.

Callers 1

Test_CodeFunction · 0.92

Calls 1

callersFunction · 0.85

Tested by 1

Test_CodeFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…