feat: progress
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user