Documentation ¶
Index ¶
- Variables
- func IsInternalError(err error) bool
- func IsUserError(err error) bool
- func WrapPanic(f func())
- type DefaultUserError
- type ErrorNote
- type ErrorNotes
- type ExternalError
- type ExternalNonError
- type HasPrefix
- type HasSuggestedFixes
- type InternalError
- type MemoryError
- type ParentError
- type SecondaryError
- type SuggestedFix
- type UnexpectedError
- type UserError
Constants ¶
This section is empty.
Variables ¶
var StackTracesEnabled = true
Functions ¶
func IsInternalError ¶
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 ¶
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.
Types ¶
type DefaultUserError ¶
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 ¶
func NewDefaultUserError(message string, arg ...any) DefaultUserError
func (DefaultUserError) Error ¶
func (e DefaultUserError) Error() string
func (DefaultUserError) IsUserError ¶
func (DefaultUserError) IsUserError()
func (DefaultUserError) Unwrap ¶
func (e DefaultUserError) Unwrap() error
type ErrorNotes ¶
type ErrorNotes interface {
ErrorNotes() []ErrorNote
}
ErrorNotes is an interface for errors that provide notes
type ExternalError ¶
type ExternalError struct {
Recovered error
}
ExternalError is an error that occurred externally. It contains the recovered value.
func GetExternalError ¶
func GetExternalError(err error) (ExternalError, bool)
GetExternalError returns the ExternalError in the error chain, if any
func NewExternalError ¶
func NewExternalError(recovered error) ExternalError
func NewExternalNonError ¶
func NewExternalNonError(recovered error) ExternalError
func (ExternalError) Error ¶
func (e ExternalError) Error() string
func (ExternalError) Unwrap ¶
func (e ExternalError) Unwrap() error
type ExternalNonError ¶
type ExternalNonError struct {
Recovered any
}
ExternalNonError is an non-error-typed panic that occurred externally. It contains the recovered value.
func (ExternalNonError) Error ¶
func (e ExternalNonError) Error() string
type HasPrefix ¶
type HasPrefix interface {
Prefix() string
}
HasPrefix is an interface for errors that provide a custom prefix
type HasSuggestedFixes ¶
type HasSuggestedFixes[T any] interface { SuggestFixes(code string) []SuggestedFix[T] }
type InternalError ¶
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 ¶
type MemoryError struct {
Err error
}
MemoryError indicates a memory limit has reached and should end the Cadence parsing, checking, or interpretation.
func (MemoryError) Error ¶
func (e MemoryError) Error() string
func (MemoryError) IsUserError ¶
func (MemoryError) IsUserError()
func (MemoryError) Unwrap ¶
func (e MemoryError) Unwrap() error
type ParentError ¶
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 ¶
type UnexpectedError ¶
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 ¶
func NewUnexpectedError(message string, arg ...any) UnexpectedError
func NewUnexpectedErrorFromCause ¶
func NewUnexpectedErrorFromCause(err error) UnexpectedError
func (UnexpectedError) Error ¶
func (e UnexpectedError) Error() string
func (UnexpectedError) IsInternalError ¶
func (UnexpectedError) IsInternalError()
func (UnexpectedError) Unwrap ¶
func (e UnexpectedError) Unwrap() error