...

Source file src/github.com/go-errors/errors/join_unwrap_1_20.go

Documentation: github.com/go-errors/errors

     1  //go:build go1.20
     2  // +build go1.20
     3  
     4  package errors
     5  
     6  import baseErrors "errors"
     7  
     8  // Join returns an error that wraps the given errors.
     9  // Any nil error values are discarded.
    10  // Join returns nil if every value in errs is nil.
    11  // The error formats as the concatenation of the strings obtained
    12  // by calling the Error method of each element of errs, with a newline
    13  // between each string.
    14  //
    15  // A non-nil error returned by Join implements the Unwrap() []error method.
    16  //
    17  // For more information see stdlib errors.Join.
    18  func Join(errs ...error) error {
    19  	return baseErrors.Join(errs...)
    20  }
    21  
    22  // Unwrap returns the result of calling the Unwrap method on err, if err's
    23  // type contains an Unwrap method returning error.
    24  // Otherwise, Unwrap returns nil.
    25  //
    26  // Unwrap only calls a method of the form "Unwrap() error".
    27  // In particular Unwrap does not unwrap errors returned by [Join].
    28  //
    29  // For more information see stdlib errors.Unwrap.
    30  func Unwrap(err error) error {
    31  	return baseErrors.Unwrap(err)
    32  }
    33  

View as plain text