Commit c99598cb authored by Ian Lance Taylor's avatar Ian Lance Taylor

errors: clarify docs for when As returns false

Change-Id: Ic8d8399f726c1f9376499fdae92bea41632586ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/193602Reviewed-by: default avatarJonathan Amsterdam <jba@google.com>
parent 2b6b474f
...@@ -59,7 +59,7 @@ func Is(err, target error) bool { ...@@ -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 // 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 // The chain consists of err itself followed by the sequence of errors obtained by
// repeatedly calling Unwrap. // repeatedly calling Unwrap.
...@@ -73,7 +73,7 @@ func Is(err, target error) bool { ...@@ -73,7 +73,7 @@ func Is(err, target error) bool {
// a different error type. // a different error type.
// //
// As panics if target is not a non-nil pointer to either a type that implements // 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 { func As(err error, target interface{}) bool {
if target == nil { if target == nil {
panic("errors: target cannot be nil") panic("errors: target cannot be nil")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment