aboutsummaryrefslogtreecommitdiff
path: root/src/errors/wrap_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/errors/wrap_test.go')
-rw-r--r--src/errors/wrap_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/errors/wrap_test.go b/src/errors/wrap_test.go
index 6f66e99c4a..a22fee2f04 100644
--- a/src/errors/wrap_test.go
+++ b/src/errors/wrap_test.go
@@ -265,3 +265,13 @@ func ExampleAs() {
// Output:
// Failed at path: non-existing
}
+
+func ExampleUnwrap() {
+ err1 := errors.New("error1")
+ err2 := fmt.Errorf("error2: [%w]", err1)
+ fmt.Println(err2)
+ fmt.Println(errors.Unwrap(err2))
+ // Output
+ // error2: [error1]
+ // error1
+}