feat: cleaner parsing functions
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user