Standard library / net/textproto
textproto.Error
Numeric protocol response error with Code and Msg fields. Constructed here as synthetic server response metadata. Expected stdout: '550 unavailable\n'.
Formal Syntax & Structure
go syntaxgo
type Error struct { Code int Msg string}Working Example
Example Snippetgo
package main
import ( "fmt" "net/textproto")
func main() { e := &textproto.Error{Code: 550, Msg: "unavailable"}; fmt.Println(e.Code, e.Msg) }
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) }}