Standard library / net
net.DNSError.Unwrap()
Return the optional underlying error, enabling errors.Is and errors.As; it may be nil. Expected stdout: 'true true\n'.
Formal Syntax & Structure
go syntaxgo
func (e *DNSError) Unwrap() errorReturn Value
error
Operation result; check errors and validity indicators when returned.
Working Example
Example Snippetgo
package main
import ( "context" "errors" "fmt" "net")
func main() { e := &net.DNSError{UnwrapErr: context.DeadlineExceeded} fmt.Println(errors.Is(e, context.DeadlineExceeded), e.Unwrap() == context.DeadlineExceeded)}
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) }}