WrapWithDepth is like Wrap except the depth to capture the stack trace is configurable. The the doc of `Wrap()` for more details.
(depth int, err error, msg string)
| 109 | // trace is configurable. |
| 110 | // The the doc of `Wrap()` for more details. |
| 111 | func WrapWithDepth(depth int, err error, msg string) error { |
| 112 | if err == nil { |
| 113 | return nil |
| 114 | } |
| 115 | if msg != "" { |
| 116 | err = WithMessage(err, msg) |
| 117 | } |
| 118 | err = withstack.WithStackDepth(err, depth+1) |
| 119 | return err |
| 120 | } |
| 121 | |
| 122 | // Wrapf wraps an error with a formatted message prefix. A stack |
| 123 | // trace is also retained. If the format is empty, no prefix is added, |
no test coverage detected
searching dependent graphs…