From: qydysky Date: Mon, 25 Mar 2024 17:19:15 +0000 (+0800) Subject: 1 X-Git-Tag: v0.28.20240325172911~1 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=beb1103e20568987869043ea56a69ace4b22eae8;p=part%2F.git 1 --- diff --git a/errors/errors.go b/errors/errors.go index 5e4330e..a5b0e90 100644 --- a/errors/errors.go +++ b/errors/errors.go @@ -97,7 +97,7 @@ func ErrorFormat(e error, format ...func(error) string) (s string) { if len(format) > 0 { s += format[0](v) } else { - s += e.Error() + "\n" + s += v.Error() + "\n" } } } else if len(format) > 0 { diff --git a/errors/errors_test.go b/errors/errors_test.go index 83c7a47..8abffca 100644 --- a/errors/errors_test.go +++ b/errors/errors_test.go @@ -32,12 +32,13 @@ func TestXxx(t *testing.T) { func Test2(t *testing.T) { e := Join(New("r0", "a0"), New("r1", "a1")) + t.Log(ErrorFormat(e)) t.Log(ErrorFormat(e, ErrSimplifyFunc)) t.Log(ErrorFormat(e, ErrInLineFunc)) - if ErrorFormat(e, ErrSimplifyFunc) != "r0\nr1\n" { + if ErrorFormat(e, ErrSimplifyFunc) != "a0\na1\n" { t.FailNow() } - if ErrorFormat(e, ErrInLineFunc) != " > r0 > r1" { + if ErrorFormat(e, ErrInLineFunc) != " > a0 > a1" { t.FailNow() } }