Standard library / net/http
http.ProtocolError
Legacy HTTP error type. Not all HTTP protocol errors use this deprecated type. Expected stdout: 'demo\n'.
Formal Syntax & Structure
go syntaxgo
type ProtocolError struct { ErrorString string}Working Example
Example Snippetgo
package main
import ( "fmt" "net/http")
func main() { var e error = &http.ProtocolError{ErrorString: "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) }}