Standard library / crypto/tls

tls.CertificateVerificationError

Wraps underlying certificate validation error and unverified peer certificate chain; never treat the latter as trusted. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
type CertificateVerificationError struct {  UnverifiedCertificates []*x509.Certificate  Err                    error}

Working Example

Example Snippetgo
package main
import (  "crypto/tls"  "errors"  "fmt")
func main() {  e := &tls.CertificateVerificationError{Err: errors.New("demo")}  fmt.Println(e.Unwrap() != nil)}
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