From: qydysky Date: Wed, 26 Mar 2025 14:35:34 +0000 (+0800) Subject: 1 (#36) X-Git-Tag: v0.28.20250326143542 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=1973bc87f1c8c4d2c41641554ae13458edaddb99;p=part%2F.git 1 (#36) --- diff --git a/errors/errors.go b/errors/errors.go index ab72a03..0353840 100644 --- a/errors/errors.go +++ b/errors/errors.go @@ -25,6 +25,13 @@ func (t Action) Error() string { return string(t) } +func (t Action) Unwrap() error { + return Error{ + action: t, + Reason: string(t), + } +} + type Error struct { Reason string action Action diff --git a/errors/errors_test.go b/errors/errors_test.go index ec0a4dd..adbdfa0 100644 --- a/errors/errors_test.go +++ b/errors/errors_test.go @@ -14,6 +14,12 @@ var a11 = a1.Append("1") func TestXxx(t *testing.T) { var err error + err = a0 + + if !Catch(err, a0) { + t.Fatal() + } + err = New("r0", a0) if !Catch(err, a0) {