in error.go [31:56]
func WithStackTraces(skip, depth int, ignores ...func(runtime.Frame) bool) func(error) error {
return func(err error) error {
pc := make([]uintptr, depth)
i := runtime.Callers(skip, pc)
pc = pc[:i]
frames := runtime.CallersFrames(pc)
withStackTraces := ErrWithStackTraces{Err: err}
for {
frame, more := frames.Next()
if !more {
break
}
isIgnored := false
for _, ignore := range ignores {
if ignore(frame) {
isIgnored = true
break
}
}
if !isIgnored {
withStackTraces.Frames = append(withStackTraces.Frames, frame)
}
}
return withStackTraces
}
}