Standard library / crypto/tls

tls.CertificateVerificationError.Unwrap()

Returns the underlying certificate verification error for errors.Is and errors.As. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (e *CertificateVerificationError) Unwrap() error

Return Value

error

Result of the operation; handle any returned error before using other results.

Working Example

Example Snippetgo
package main
import (  "crypto/tls"  "errors"  "fmt")
func main() {  cause := errors.New("demo")  e := &tls.CertificateVerificationError{Err: cause}  fmt.Println(errors.Is(e, cause))}
func must[T any](v T, e error) T {  if e != nil {    panic(e)  }  return v}func check(e error) {  if e != nil {    panic(e)  }}
Go Reference