jet/internal/utils/errfmt/errfmt.go

15 lines
294 B
Go
Raw Normal View History

2023-07-21 13:20:44 +02:00
package errfmt
import (
2023-07-21 17:10:39 +02:00
"github.com/go-jet/jet/v2/internal/utils/is"
2023-07-21 13:20:44 +02:00
"strings"
)
// Trace returns well formatted wrapped error trace string
func Trace(err error) string {
2023-07-21 17:10:39 +02:00
if is.Nil(err) {
return ""
}
2023-07-21 13:20:44 +02:00
return "Error trace:\n" + " - " + strings.Replace(err.Error(), ": ", ":\n - ", -1)
}