Standard library / encoding/xml

encoding/xml.UnsupportedTypeError.Error()

Describes a Go type that cannot be marshaled as XML. Expected stdout: 'true true\n'.

Formal Syntax & Structure

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

Return Value

string

Text representation.

Working Example

Example Snippetgo
package main
import (  "encoding/xml"  "errors"  "fmt"  "strings")
func must(e error) {  if e != nil {    panic(e)  }}
func main() {  _, e := xml.Marshal(make(chan int))  var ue *xml.UnsupportedTypeError  fmt.Println(errors.As(e, &ue), strings.Contains(ue.Error(), "unsupported type"))}
Go Reference