errors

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrTimeout            = "execution timeout"
	ErrCancelled          = "execution cancelled"
	ErrDivisionByZero     = "division by zero"
	ErrIndexOutOfRange    = "index out of range"
	ErrKeyNotFound        = "key not found"
	ErrTypeError          = "type error"
	ErrArgumentError      = "argument error"
	ErrIdentifierNotFound = "identifier not found"
	ErrUnknownOperator    = "unknown operator"
	ErrImportError        = "import error"
	ErrCallDepthExceeded  = "call depth exceeded"
	ErrPanic              = "script panic"
)

Common error types

Variables

This section is empty.

Functions

func ExactArgs

func ExactArgs(args []object.Object, n int) object.Object

ExactArgs checks that args has exactly n elements

func MaxArgs

func MaxArgs(args []object.Object, n int) object.Object

MaxArgs checks that args has at most n elements

func MinArgs

func MinArgs(args []object.Object, n int) object.Object

MinArgs checks that args has at least n elements

func NewArgumentError

func NewArgumentError(got, want int) *object.Error

NewArgumentError creates an argument error

func NewCallDepthExceededError

func NewCallDepthExceededError(max int) *object.Error

NewCallDepthExceededError creates a call depth exceeded error

func NewCancelledError

func NewCancelledError() *object.Error

NewCancelledError creates a cancellation error

func NewError

func NewError(format string, args ...interface{}) *object.Error

NewError creates a new error object

func NewIdentifierError

func NewIdentifierError(name string) *object.Error

NewIdentifierError creates an identifier not found error

func NewPanicError

func NewPanicError(panicValue interface{}) *object.Error

NewPanicError creates a panic error with the panic value

func NewTimeoutError

func NewTimeoutError() *object.Error

NewTimeoutError creates a timeout error

func NewTypeError

func NewTypeError(expected, got string) *object.Error

NewTypeError creates a type error

func NoArgs

func NoArgs(args []object.Object) object.Object

NoArgs checks that args has no elements

func ParameterError

func ParameterError(name string, err object.Object) object.Object

ParameterError wraps an error with a parameter name for context

func RangeArgs

func RangeArgs(args []object.Object, min, max int) object.Object

RangeArgs checks that args has between min and max elements (inclusive)

Types

This section is empty.

Jump to

Keyboard shortcuts

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