errors

package
v0.0.0-...-b160839 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2023 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ThrowFilterArgumentError

func ThrowFilterArgumentError(fname, format string, args ...any)

ThrowFilterArgumentError throws a filter argument error.

func ThrowSyntaxError

func ThrowSyntaxError(token *Token, format string, args ...any)

ThrowSyntaxError throws a syntax error.

func ThrowTemplateAssertionError

func ThrowTemplateAssertionError(fname, format string, args ...any)

ThrowTemplateAssertionError throws a filter argument error.

func ThrowTemplateRuntimeError

func ThrowTemplateRuntimeError(format string, args ...any)

ThrowTemplateRuntimeError throws a generic template runtime error.

func ThrowUndefinedError

func ThrowUndefinedError(varName, hint string)

ThrowUndefinedError throws an undefined error.

Types

type FilterArgumentError

type FilterArgumentError interface {
	TemplateRuntimeError
	FilterName() string
}

FilterArgumentError is thrown when a filter is called with invalid arguments.

type TemplateAssertionError

type TemplateAssertionError interface {
	TemplateSyntaxError
	TemplateAssertionError()
}

TemplateAssertionError is thrown when a filter is called with invalid arguments.

type TemplateError

type TemplateError interface {
	error
	TemplateError()
}

TemplateError is a generic template error.

type TemplateLoadError

type TemplateLoadError interface {
	TemplateError
	TemplateLoadError()
	Name() string
}

TemplateLoadError is thrown when a template cannot be loaded.

func NewTemplateLoadError

func NewTemplateLoadError(name, format string, args ...any) TemplateLoadError

NewTemplateLoadError creates a new TemplateLoadError.

type TemplateNotFoundError

type TemplateNotFoundError interface {
	TemplateError
	TemplateNotFoundError()
	Name() string
}

TemplateNotFoundError is thrown when a filter is called with invalid arguments.

func NewTemplateNotFoundError

func NewTemplateNotFoundError(name string) TemplateNotFoundError

NewTemplateNotFoundError creates a new TemplateNotFoundError.

type TemplateRuntimeError

type TemplateRuntimeError interface {
	TemplateError
	TemplateRuntimeError()
	Enrich(*Token)
	Token() *Token
}

TemplateRuntimeError is a generic runtime error. It is used as a base for other more specific runtime errors.

func NewTemplateRuntimeError

func NewTemplateRuntimeError(format string, args ...any) TemplateRuntimeError

NewTemplateRuntimeError creates a new TemplateRuntimeError.

type TemplateSyntaxError

type TemplateSyntaxError interface {
	TemplateError
	TemplateSyntaxError()
	Pos() int
}

TemplateSyntaxError is thrown when a filter is called with invalid arguments.

type TemplatesNotFoundError

type TemplatesNotFoundError interface {
	TemplateError
	TemplatesNotFoundError()
	Names() []string
}

TemplatesNotFoundError is thrown when a filter is called with invalid arguments.

type Token

type Token struct {
	Val  string
	Pos  int
	Line int
	Col  int
}

Token is a token representation for error reporting.

func (Token) String

func (t Token) String() string

String returns a string representation of the token.

type UndefinedError

type UndefinedError interface {
	TemplateRuntimeError
	VariableName() string
}

UndefinedError is thrown when an action is performed on an undefined variable.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL