errors

package
v1.19.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	As  = errors.As
	Is  = errors.Is
	New = errors.New
)

Functions

func FormatError

func FormatError(errMsg string, token *token.Token, colored, inclSource bool) string

Types

type DuplicateKeyError

type DuplicateKeyError struct {
	Message string
	Token   *token.Token
}

func ErrDuplicateKey

func ErrDuplicateKey(msg string, tk *token.Token) *DuplicateKeyError

ErrDuplicateKey creates an duplicate key error instance with token.

func (*DuplicateKeyError) Error

func (e *DuplicateKeyError) Error() string

func (*DuplicateKeyError) FormatError

func (e *DuplicateKeyError) FormatError(colored, inclSource bool) string

func (*DuplicateKeyError) GetMessage

func (e *DuplicateKeyError) GetMessage() string

func (*DuplicateKeyError) GetToken

func (e *DuplicateKeyError) GetToken() *token.Token

type Error

type Error interface {
	error
	GetToken() *token.Token
	GetMessage() string
	FormatError(bool, bool) string
}

type OverflowError

type OverflowError struct {
	DstType reflect.Type
	SrcNum  string
	Token   *token.Token
}

func ErrOverflow

func ErrOverflow(dstType reflect.Type, num string, tk *token.Token) *OverflowError

ErrOverflow creates an overflow error instance with message and a token.

func (*OverflowError) Error

func (e *OverflowError) Error() string

func (*OverflowError) FormatError

func (e *OverflowError) FormatError(colored, inclSource bool) string

func (*OverflowError) GetMessage

func (e *OverflowError) GetMessage() string

func (*OverflowError) GetToken

func (e *OverflowError) GetToken() *token.Token

type SyntaxError

type SyntaxError struct {
	Message string
	Token   *token.Token
}

func ErrSyntax

func ErrSyntax(msg string, tk *token.Token) *SyntaxError

ErrSyntax create syntax error instance with message and token

func (*SyntaxError) Error

func (e *SyntaxError) Error() string

func (*SyntaxError) FormatError

func (e *SyntaxError) FormatError(colored, inclSource bool) string

func (*SyntaxError) GetMessage

func (e *SyntaxError) GetMessage() string

func (*SyntaxError) GetToken

func (e *SyntaxError) GetToken() *token.Token

type TypeError

type TypeError struct {
	DstType         reflect.Type
	SrcType         reflect.Type
	StructFieldName *string
	Token           *token.Token
}

func ErrTypeMismatch

func ErrTypeMismatch(dstType, srcType reflect.Type, token *token.Token) *TypeError

ErrTypeMismatch cerates an type mismatch error instance with token.

func (*TypeError) Error

func (e *TypeError) Error() string

func (*TypeError) FormatError

func (e *TypeError) FormatError(colored, inclSource bool) string

func (*TypeError) GetMessage

func (e *TypeError) GetMessage() string

func (*TypeError) GetToken

func (e *TypeError) GetToken() *token.Token

type UnexpectedNodeTypeError

type UnexpectedNodeTypeError struct {
	Actual   ast.NodeType
	Expected ast.NodeType
	Token    *token.Token
}

func ErrUnexpectedNodeType

func ErrUnexpectedNodeType(actual, expected ast.NodeType, tk *token.Token) *UnexpectedNodeTypeError

func (*UnexpectedNodeTypeError) Error

func (e *UnexpectedNodeTypeError) Error() string

func (*UnexpectedNodeTypeError) FormatError

func (e *UnexpectedNodeTypeError) FormatError(colored, inclSource bool) string

func (*UnexpectedNodeTypeError) GetMessage

func (e *UnexpectedNodeTypeError) GetMessage() string

func (*UnexpectedNodeTypeError) GetToken

func (e *UnexpectedNodeTypeError) GetToken() *token.Token

type UnknownFieldError

type UnknownFieldError struct {
	Message string
	Token   *token.Token
}

func ErrUnknownField

func ErrUnknownField(msg string, tk *token.Token) *UnknownFieldError

ErrUnknownField creates an unknown field error instance with token.

func (*UnknownFieldError) Error

func (e *UnknownFieldError) Error() string

func (*UnknownFieldError) FormatError

func (e *UnknownFieldError) FormatError(colored, inclSource bool) string

func (*UnknownFieldError) GetMessage

func (e *UnknownFieldError) GetMessage() string

func (*UnknownFieldError) GetToken

func (e *UnknownFieldError) GetToken() *token.Token

Jump to

Keyboard shortcuts

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