No description, website, or topics provided.
Branch: master
Clone or download
neild xerrors: require that error be type assertable to As's target
Document As(err, target) as panicking when *target is not of interface
type and does not implement the error interface. While this prevents
some clever tricks, it permits catching (at runtime or statically
via vet) type errors equivalent to the ones that can be detected
by type assertions.

  if e := os.PathError{}; errors.As(err, &e) {  // error, os.PathError does not implement error
  if e := &os.PathError{}; errors.As(err, e) {  // error, os.PathError does not implement error
  if e := &os.PathError{}; errors.As(err, &e) { // ok

  var e interface{ Timeout() bool }
  if errors.As(&e) && e.Timeout() { // ok

Change-Id: I3607ac62fbe8aebef3c1aeec3fb414fb41afcdda
Reviewed-on: https://go-review.googlesource.com/c/161899
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Latest commit a5947ff Feb 12, 2019

README

This repository holds the transition packages for the new Go 1.13 error values.
See golang.org/design/29934-error-values.