Standard library / text/template

text/template.ExecError.Error()

Returns the formatted evaluation error text. Expected stdout: 'demo failure\n'.

Formal Syntax & Structure

go syntaxgo
func (e ExecError) Error() string

Return Value

string

Returns the formatted evaluation error text.

Working Example

Example Snippetgo
package main
import (  "errors"  "fmt"  "text/template")
func main() {  e := template.ExecError{Name: "x", Err: errors.New("demo failure")}  fmt.Println(e.Error())}
Go Reference