feat: copied code over

This commit is contained in:
2026-01-19 19:32:08 -05:00
parent 5f2dcc9394
commit 091bc70172
18 changed files with 1102 additions and 6 deletions

25
pkg/trace/trace.go Normal file
View File

@@ -0,0 +1,25 @@
package trace
import (
"errors"
"fmt"
"strings"
)
func Indent(s string, size int) string {
lines := strings.Lines(s)
indent := strings.Repeat(" ", size)
indented := ""
for line := range lines {
indented += indent + line
}
return indented
}
func Wrap(child error, format string, a ...any) error {
parent := fmt.Errorf(format, a...)
childErrString := Indent(child.Error(), 4)
return errors.New(parent.Error() + "\n" + childErrString)
}