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)
| 100 | // It returns nil if given err is nil. |
| 101 | // The parameter `skip` specifies the stack callers skipped amount. |
| 102 | func 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. |