feat: better error messages

This commit is contained in:
2025-12-27 02:39:56 -05:00
parent 884180de92
commit 1896cd652d
6 changed files with 70 additions and 51 deletions

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

@@ -0,0 +1,23 @@
package trace
import (
"errors"
"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 WrapError(parent error, child error) error {
childErrString := Indent(child.Error(), 4)
return errors.New(parent.Error() + "\n" + childErrString)
}