]> 127.0.0.1 Git - part/.git/commitdiff
1 (#36) v0.28.20250326143542
authorqydysky <qydysky@foxmail.com>
Wed, 26 Mar 2025 14:35:34 +0000 (22:35 +0800)
committerGitHub <noreply@github.com>
Wed, 26 Mar 2025 14:35:34 +0000 (22:35 +0800)
errors/errors.go
errors/errors_test.go

index ab72a030248ac7f7f3c64f3e3c82c47f961ba903..03538409a0d95c6bebd8dba53432fa00089c3c39 100644 (file)
@@ -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
index ec0a4dda7d6b1ff3b668a8c02a0d275cf7d54a89..adbdfa0a916b20d1ef6d16dfba7d71619134cf63 100644 (file)
@@ -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) {