Standard library / net/http

http.ProtocolError.Is()

Supports matching ErrNotSupported to errors.ErrUnsupported. Other ProtocolError values do not have that special match. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (pe *ProtocolError) Is(err error) bool

Parameters & Attributes

NameTypeDescription
errerrorTarget error for comparison.

Return Value

bool

Operation result; check errors and validity indicators when returned.

Working Example

Example Snippetgo
package main
import (  "errors"  "fmt"  "net/http")
func main() { fmt.Println(errors.Is(http.ErrNotSupported, errors.ErrUnsupported)) }
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