errors

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StackTracesEnabled = true

Functions

func IsInternalError added in v0.25.0

func IsInternalError(err error) bool

IsInternalError Checks whether a given error was caused by an InternalError. An error in an internal error, if it has at-least one InternalError in the error chain.

func IsUserError added in v0.25.0

func IsUserError(err error) bool

IsUserError Checks whether a given error was caused by an UserError. An error in a user error, if it has at-least one UserError in the error chain.

func WrapPanic added in v0.32.0

func WrapPanic(f func())

Types

type DefaultUserError added in v0.25.0

type DefaultUserError struct {
	Err error
}

DefaultUserError is the default implementation of UserError interface. It's a generic error that wraps a user error.

func NewDefaultUserError added in v0.25.0

func NewDefaultUserError(message string, arg ...any) DefaultUserError

func (DefaultUserError) Error added in v0.25.0

func (e DefaultUserError) Error() string

func (DefaultUserError) IsUserError added in v0.25.0

func (DefaultUserError) IsUserError()

func (DefaultUserError) Unwrap added in v0.25.0

func (e DefaultUserError) Unwrap() error

type ErrorNote

type ErrorNote interface {
	Message() string
}

type ErrorNotes

type ErrorNotes interface {
	ErrorNotes() []ErrorNote
}

ErrorNotes is an interface for errors that provide notes

type ExternalError added in v0.25.0

type ExternalError struct {
	Recovered error
}

ExternalError is an error that occurred externally. It contains the recovered value.

func GetExternalError added in v0.25.0

func GetExternalError(err error) (ExternalError, bool)

GetExternalError returns the ExternalError in the error chain, if any

func NewExternalError added in v0.25.0

func NewExternalError(recovered error) ExternalError

func NewExternalNonError added in v0.32.0

func NewExternalNonError(recovered error) ExternalError

func (ExternalError) Error added in v0.25.0

func (e ExternalError) Error() string

func (ExternalError) Unwrap added in v0.32.0

func (e ExternalError) Unwrap() error

type ExternalNonError added in v0.32.0

type ExternalNonError struct {
	Recovered any
}

ExternalNonError is an non-error-typed panic that occurred externally. It contains the recovered value.

func (ExternalNonError) Error added in v0.32.0

func (e ExternalNonError) Error() string

type HasPrefix added in v0.25.0

type HasPrefix interface {
	Prefix() string
}

HasPrefix is an interface for errors that provide a custom prefix

type HasSuggestedFixes added in v1.0.0

type HasSuggestedFixes[T any] interface {
	SuggestFixes(code string) []SuggestedFix[T]
}

type InternalError added in v0.25.0

type InternalError interface {
	error
	IsInternalError()
}

InternalError is an implementation error, e.g: an unreachable code path (UnreachableError). A program should never throw an InternalError in an ideal world.

InternalError s must always be thrown and not be caught (recovered), i.e. be propagated up the call stack.

func NewUnreachableError

func NewUnreachableError() InternalError

NewUnreachableError creates an internal error that indicates executing an unimplemented path.

type MemoryError added in v0.25.0

type MemoryError struct {
	Err error
}

MemoryError indicates a memory limit has reached and should end the Cadence parsing, checking, or interpretation.

func (MemoryError) Error added in v0.25.0

func (e MemoryError) Error() string

func (MemoryError) IsUserError added in v0.25.0

func (MemoryError) IsUserError()

func (MemoryError) Unwrap added in v0.25.0

func (e MemoryError) Unwrap() error

type ParentError

type ParentError interface {
	error
	ChildErrors() []error
}

ParentError is an error that contains one or more child errors.

type SecondaryError

type SecondaryError interface {
	SecondaryError() string
}

SecondaryError is an interface for errors that provide a secondary error message

type SuggestedFix added in v1.0.0

type SuggestedFix[T any] struct {
	Message   string
	TextEdits []T
}

type UnexpectedError added in v0.25.0

type UnexpectedError struct {
	Err   error
	Stack []byte
}

UnexpectedError is the default implementation of InternalError interface. It's a generic error that wraps an implementation error, which should have never occurred.

NOTE: This error is not used for errors occur due to bugs in a user-provided program.

func NewUnexpectedError added in v0.25.0

func NewUnexpectedError(message string, arg ...any) UnexpectedError

func NewUnexpectedErrorFromCause added in v0.25.0

func NewUnexpectedErrorFromCause(err error) UnexpectedError

func (UnexpectedError) Error added in v0.25.0

func (e UnexpectedError) Error() string

func (UnexpectedError) IsInternalError added in v0.25.0

func (UnexpectedError) IsInternalError()

func (UnexpectedError) Unwrap added in v0.25.0

func (e UnexpectedError) Unwrap() error

type UserError added in v0.25.0

type UserError interface {
	error
	IsUserError()
}

UserError is an error thrown for an error in the user-code, e.g. exceeding a metering limit.

Jump to

Keyboard shortcuts

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