gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

go113.go (1451B)


      1 // +build go1.13
      2 
      3 package errors
      4 
      5 import (
      6 	stderrors "errors"
      7 )
      8 
      9 // Is reports whether any error in err's chain matches target.
     10 //
     11 // The chain consists of err itself followed by the sequence of errors obtained by
     12 // repeatedly calling Unwrap.
     13 //
     14 // An error is considered to match a target if it is equal to that target or if
     15 // it implements a method Is(error) bool such that Is(target) returns true.
     16 func Is(err, target error) bool { return stderrors.Is(err, target) }
     17 
     18 // As finds the first error in err's chain that matches target, and if so, sets
     19 // target to that error value and returns true.
     20 //
     21 // The chain consists of err itself followed by the sequence of errors obtained by
     22 // repeatedly calling Unwrap.
     23 //
     24 // An error matches target if the error's concrete value is assignable to the value
     25 // pointed to by target, or if the error has a method As(interface{}) bool such that
     26 // As(target) returns true. In the latter case, the As method is responsible for
     27 // setting target.
     28 //
     29 // As will panic if target is not a non-nil pointer to either a type that implements
     30 // error, or to any interface type. As returns false if err is nil.
     31 func As(err error, target interface{}) bool { return stderrors.As(err, target) }
     32 
     33 // Unwrap returns the result of calling the Unwrap method on err, if err's
     34 // type contains an Unwrap method returning error.
     35 // Otherwise, Unwrap returns nil.
     36 func Unwrap(err error) error {
     37 	return stderrors.Unwrap(err)
     38 }