Standard library / crypto/tls

tls.CertificateVerificationError.Error()

Formats a certificate verification error. This example constructs a synthetic error for illustration. Expected stdout: 'tls: failed to verify certificate: demo\n'.

Formal Syntax & Structure

go syntaxgo
func (e *CertificateVerificationError) Error() string

Return Value

string

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() { e := &tls.CertificateVerificationError{Err: errors.New("demo")}; fmt.Println(e.Error()) }
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