errz

package
v0.0.3-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package errz defines a FriendlyError interface for errors that have a human friendly message in addition to the default error message.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreTypeErrorsFatal

func AreTypeErrorsFatal() bool

AreTypeErrorsFatal returns whether type errors are considered fatal.

func SetTypeErrorsAreFatal

func SetTypeErrorsAreFatal(fatal bool)

SetTypeErrorsAreFatal sets whether type errors should be considered fatal.

Types

type ArgsError

type ArgsError struct {
	Err error
}

ArgsError is used to indicate an error that occurred while processing function arguments. All ArgsErrors are considered fatal errors. This should be reserved for use in cases where a function call basically should not compile due to the number of arguments passed.

func ArgsErrorf

func ArgsErrorf(format string, args ...any) *ArgsError

func NewArgsError

func NewArgsError(err error) *ArgsError

func (*ArgsError) Error

func (a *ArgsError) Error() string

func (*ArgsError) IsFatal

func (a *ArgsError) IsFatal() bool

func (*ArgsError) Unwrap

func (a *ArgsError) Unwrap() error

type Error

type Error interface {
	Error() string
	IsFatal() bool
}

type EvalError

type EvalError struct {
	Err error
}

EvalError is used to indicate an unrecoverable error that occurred during program evaluation. All EvalErrors are considered fatal errors.

func EvalErrorf

func EvalErrorf(format string, args ...any) *EvalError

func NewEvalError

func NewEvalError(err error) *EvalError

func (*EvalError) Error

func (r *EvalError) Error() string

func (*EvalError) IsFatal

func (r *EvalError) IsFatal() bool

func (*EvalError) Unwrap

func (r *EvalError) Unwrap() error

type FriendlyError

type FriendlyError interface {
	Error() string
	FriendlyErrorMessage() string
}

FriendlyError is an interface for errors that have a human friendly message in addition to a the lower level default error message.

type TypeError

type TypeError struct {
	Err error
	// contains filtered or unexported fields
}

TypeError is used to indicate an invalid type was supplied. These may or may not be fatal errors depending on typeErrorsAreFatal setting.

func NewTypeError

func NewTypeError(err error) *TypeError

func TypeErrorf

func TypeErrorf(format string, args ...any) *TypeError

func (*TypeError) Error

func (t *TypeError) Error() string

func (*TypeError) IsFatal

func (t *TypeError) IsFatal() bool

func (*TypeError) Unwrap

func (t *TypeError) Unwrap() error

Jump to

Keyboard shortcuts

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