24 lines
404 B
Go
24 lines
404 B
Go
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)
|
|
}
|