Errors

type Error

type Error struct {
    SourceType               string   // The type of source that failed to build.
    Title, Path, Description string   // Description of the error, as presented to the user.
    Line, Column             int      // Where the error was encountered.
    SourceLines              []string // The entire source file, split into lines.
    Stack                    string   // The raw stack trace string from debug.Stack().
    MetaError                string   // Error that occurred producing the error page.
}

An error description, used as an argument to the error template.

func NewErrorFromPanic

func NewErrorFromPanic(err interface{}) *Error

Find the deepest stack from in user code and provide a code listing of that, on the line that eventually triggered the panic. Returns nil if no relevant stack frame can be found.

func (*Error) ContextSource

func (e *Error) ContextSource() []sourceLine

Returns a snippet of the source around where the error occurred.

func (*Error) Error

func (e *Error) Error() string

Construct a plaintext version of the error, taking account that fields are optionally set. Returns e.g. Compilation Error (in views/header.html:51): expected right delim in end; got "}"