errors

package
v0.0.0-...-1fe86a1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	*position.Location
	Message string
}

Represents a single error in a particular source location.

func NewError

func NewError(loc *position.Location, msg string) *Error

Create a new error.

func (*Error) Error

func (e *Error) Error() string

Implements the error interface.

func (*Error) HumanString

func (e *Error) HumanString(style bool) (string, error)

Return a string representation of this error that can be presented to humans.

func (*Error) HumanStringWithSource

func (e *Error) HumanStringWithSource(source string, style bool) string

Return a string representation of this error that can be presented to humans.

func (*Error) String

func (e *Error) String() string

Implements the fmt.Stringer interface

type ErrorList

type ErrorList []*Error

ErrorList is a list of *Errors. The zero value for an ErrorList is an empty ErrorList ready to use.

func (*ErrorList) Add

func (e *ErrorList) Add(message string, loc *position.Location)

Add a new syntax error.

func (*ErrorList) Append

func (e *ErrorList) Append(err *Error)

Add a new syntax error.

func (ErrorList) Err

func (e ErrorList) Err() error

Err returns an error equivalent to this error list. If the list is empty, Err returns nil.

func (ErrorList) Error

func (e ErrorList) Error() string

Implements the error interface.

func (ErrorList) HumanString

func (el ErrorList) HumanString(style bool) (string, error)

Return a string representation of this error list that can be presented to humans.

func (ErrorList) HumanStringWithSource

func (e ErrorList) HumanStringWithSource(source string, style bool) string

Return a string representation of this error list that can be presented to humans.

func (ErrorList) Join

func (e ErrorList) Join(other ErrorList) ErrorList

Create a new slice containing the elements of the two given error lists.

Jump to

Keyboard shortcuts

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