fail

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Parser errors
	ErrEmptyBrackets          = "bracket statement must contain an expression '{{ <expression> }}'"
	ErrWrongNextToken         = "expected next token to be '%s', got '%s' instead"
	ErrExpectedExpression     = "expected expression, got '}}'"
	ErrCouldNotParseAs        = "could not parse '%s' as '%s'"
	ErrNoPrefixParseFunc      = "no prefix parse function for '%s'"
	ErrIllegalToken           = "illegal token '%s' found"
	ErrElseifCannotFollowElse = "'@elseif' directive cannot follow '@else'"
	ErrInsertStmtNotDefined   = "the insert statement named '%s' is not defined"
	ErrExpectedIdentifier     = "expected identifier, got '%s' instead"
	ErrExceptedComponentStmt  = "expected *ComponentStmt, got %T"
	ErrComponentMustHaveBlock = "the component '%s' must have a block"
	ErrExpectedObjectLiteral  = "expected object literal, got '%s' instead"

	// Evaluator (interpreter) errors
	ErrUnknownNodeType         = "unknown node type '%T'"
	ErrInsertMustHaveContent   = "the INSERT statement must have a content or a text argument"
	ErrIdentifierNotFound      = "identifier '%s' not found"
	ErrIndexNotSupported       = "the index operator '%s' is not supported"
	ErrUnknownOperator         = "unknown operator '%s%s'"
	ErrTypeMismatch            = "type mismatch '%s %s %s'"
	ErrUnknownTypeForOperator  = "unknown type '%s' for '%s' operator"
	ErrPrefixOperatorIsWrong   = "prefix operator '%s' cannot be applied to '%s'"
	ErrUseStmtMustHaveProgram  = "the 'use' statement must have a program attached"
	ErrNoFuncForThisType       = "function '%s' doesn't exist for type '%s'"
	ErrLoopVariableIsReserved  = "the 'loop' variable is reserved. You cannot use it as a variable name"
	ErrVariableTypeMismatch    = "cannot assign variable '%s' of type '%s' to type '%s'"
	ErrDotOperatorNotSupported = "the dot operator is not supported for type '%s'"
	ErrPropertyNotFound        = "property '%s' not found in type '%s'"

	// Template errors
	ErrUnsupportedType   = "unsupported type '%T'"
	ErrTemplateNotFound  = "template not found"
	ErrUseStmtNotAllowed = "the 'use' statement is not allowed in a layout file. It will cause infinite recursion"

	NoErrorsFound = "there are no Textwire errors"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error is the main error type for Textwire that contains all the necessary information about the error like the line number, file path, etc.

func FromError

func FromError(err error, line uint, absPath, origin string, args ...interface{}) *Error

func New

func New(line uint, filepath, origin, msg string, args ...interface{}) *Error

New creates a new Error instance of Error

func (*Error) Error added in v0.0.4

func (e *Error) Error() error

func (*Error) FatalOnError

func (e *Error) FatalOnError()

FatalOnError calls log.Fatal if the error message is not empty

func (*Error) PanicOnError

func (e *Error) PanicOnError()

PanicOnError panics if the error message is not empty

func (*Error) PrintOnError

func (e *Error) PrintOnError()

PrintOnError prints the error message to the standard output when the error message is not empty

func (*Error) String

func (e *Error) String() string

String returns the full error message with all the details

Jump to

Keyboard shortcuts

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