errs

package
v0.0.0-...-977da3f Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Lexer errors
	ErrFailedToReadContent = fmt.Errorf("failed to read content")
	SyntaxError            = fmt.Errorf("syntax error")

	// Runtime errors
	RuntimeError             = fmt.Errorf("runtime error")
	ValueError               = fmt.Errorf("%w: value error", RuntimeError)
	CannotRedeclareVariable  = fmt.Errorf("%w: cannot redeclare variable", RuntimeError)
	VariableNotDeclared      = fmt.Errorf("%w: variable not declared", RuntimeError)
	CannotReassignConstant   = fmt.Errorf("%w: cannot reassign constant", RuntimeError)
	CannotAccessVariable     = fmt.Errorf("%w: cannot access variable", RuntimeError)
	CannotRedecareFunction   = fmt.Errorf("%w: cannot redeclare function", RuntimeError)
	CannotReUseNamespace     = fmt.Errorf("%w: cannot reuse namespace", RuntimeError)
	CannotAccessNamespace    = fmt.Errorf("%w: cannot access namespace", RuntimeError)
	CannotAccessFunction     = fmt.Errorf("%w: cannot access function", RuntimeError)
	InvalidArguments         = fmt.Errorf("%w: invalid arguments", RuntimeError)
	IndexOutOfRange          = fmt.Errorf("%w: index out of range", RuntimeError)
	CannotReassignDefinition = fmt.Errorf("%w: cannot reassign definition", RuntimeError)
	ThisNotInMethod          = fmt.Errorf("%w: 'this' cannot be used outside a definition", RuntimeError)
)

Functions

func WithDebug

func WithDebug(err error, debug *models.Debug) error

WithDebug adds debug information to an error

Types

type DebugError

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

DebugError is an error with debug information

func (DebugError) Error

func (de DebugError) Error() string

Error returns the error message with debug information

func (DebugError) GetColumn

func (de DebugError) GetColumn() int

func (DebugError) GetFile

func (de DebugError) GetFile() string

func (DebugError) GetLine

func (de DebugError) GetLine() int

func (DebugError) GetParentError

func (de DebugError) GetParentError() error

func (DebugError) HttpError

func (de DebugError) HttpError() *HtmlError

HttpError returns the error message with debug information for HTTP

type HtmlError

type HtmlError struct {
	Code []byte
	// contains filtered or unexported fields
}

HtmlError is an error with HTML debug information

func NewHtmlError

func NewHtmlError(de *DebugError) *HtmlError

NewHtmlError creates a new HtmlError

func (*HtmlError) Debug

func (he *HtmlError) Debug() *DebugError

func (*HtmlError) Error

func (he *HtmlError) Error() string

Error returns the error message with HTML debug information

Jump to

Keyboard shortcuts

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