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

Function WrapSkip

errors/gerror/gerror_api.go:86–96  ·  view source on GitHub ↗

WrapSkip wraps error with text. It returns nil if given err is nil. The parameter `skip` specifies the stack callers skipped amount. Note that it does not lose the error code of wrapped error, as it inherits the error code from it.

(skip int, err error, text string)

Source from the content-addressed store, hash-verified

84// The parameter `skip` specifies the stack callers skipped amount.
85// Note that it does not lose the error code of wrapped error, as it inherits the error code from it.
86func WrapSkip(skip int, err error, text string) error {
87 if err == nil {
88 return nil
89 }
90 return &Error{
91 error: err,
92 stack: callers(skip),
93 text: text,
94 code: Code(err),
95 }
96}
97
98// WrapSkipf wraps error with text that is formatted with given format and args. It returns nil if given err is nil.
99// The parameter `skip` specifies the stack callers skipped amount.

Callers 1

Test_WrapSkipFunction · 0.92

Calls 2

callersFunction · 0.85
CodeFunction · 0.70

Tested by 1

Test_WrapSkipFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…