feat: cleaner parsing functions

This commit is contained in:
2025-12-27 20:46:10 -05:00
parent c37e96770f
commit 14fc4b30da
5 changed files with 121 additions and 85 deletions

View File

@@ -2,6 +2,7 @@ package trace
import (
"errors"
"fmt"
"strings"
)
@@ -17,7 +18,8 @@ func Indent(s string, size int) string {
return indented
}
func WrapError(parent error, child error) error {
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)
}