]> Cypherpunks repositories - gostls13.git/commitdiff
errors: clarify docs for when As returns false
authorIan Lance Taylor <iant@golang.org>
Thu, 5 Sep 2019 20:24:26 +0000 (13:24 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 6 Sep 2019 00:03:32 +0000 (00:03 +0000)
Change-Id: Ic8d8399f726c1f9376499fdae92bea41632586ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/193602
Reviewed-by: Jonathan Amsterdam <jba@google.com>
src/errors/wrap.go

index 65e6c448538e74dd603c6adc98bda4d7f2cf0cbe..688c58539691638b405d0025c640affe41379e78 100644 (file)
@@ -59,7 +59,7 @@ func Is(err, target error) bool {
 }
 
 // As finds the first error in err's chain that matches target, and if so, sets
-// target to that error value and returns true.
+// target to that error value and returns true. Otherwise, it returns false.
 //
 // The chain consists of err itself followed by the sequence of errors obtained by
 // repeatedly calling Unwrap.
@@ -73,7 +73,7 @@ func Is(err, target error) bool {
 // a different error type.
 //
 // As panics if target is not a non-nil pointer to either a type that implements
-// error, or to any interface type. As returns false if err is nil.
+// error, or to any interface type.
 func As(err error, target interface{}) bool {
        if target == nil {
                panic("errors: target cannot be nil")