werr

package
v1.13.3 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotABoolean               = NewStaticError("not a boolean")
	ErrNotAnInputPort            = NewStaticError("not an input port")
	ErrNotAnOutputPort           = NewStaticError("not an output port")
	ErrNotABox                   = NewStaticError("not a box")
	ErrNotAnOpaqueValue          = NewStaticError("not an opaque value")
	ErrNotAByte                  = NewStaticError("not a byte")
	ErrNotAByteInputPort         = NewStaticError("not a byte input port")
	ErrNotAByteOutputPort        = NewStaticError("not a byte output port")
	ErrNotATextualPort           = NewStaticError("not a textual port")
	ErrStopIteration             = NewStaticError("stop iteration")
	ErrNotAPrimitive             = NewStaticError("not a primitive")
	ErrNoSuchBinding             = NewStaticError("no such binding")
	ErrNotANumber                = NewStaticError("not a number")
	ErrCannotCompare             = NewStaticError("cannot compare values")
	ErrNotAReal                  = NewStaticError("not a real number")
	ErrDivisionByZero            = NewStaticError("division by zero")
	ErrNotAList                  = NewStaticError("not a list")
	ErrNotACloseParen            = NewStaticError("not a close parenthesis")
	ErrWrongNumberOfArguments    = NewStaticError("wrong number of arguments")
	ErrNotAPair                  = NewStaticError("not a pair")
	ErrNotACons                  = NewStaticError("not a cons")
	ErrNotACharacter             = NewStaticError("not a character")
	ErrStackUnderflow            = NewStaticError("stack underflow")
	ErrNotASyntaxValue           = NewStaticError("not a syntax value")
	ErrNotASyntaxPair            = NewStaticError("not a syntax pair")
	ErrNotASyntaxSymbol          = NewStaticError("not a syntax symbol")
	ErrNotASyntaxList            = NewStaticError("not a syntax list")
	ErrNotASyntaxObject          = NewStaticError("not a syntax object")
	ErrNotASymbol                = NewStaticError("not a symbol")
	ErrInvalidSyntax             = NewStaticError("invalid syntax")
	ErrInvalidArgument           = NewStaticError("invalid argument")
	ErrDuplicateBinding          = NewStaticError("duplicate binding")
	ErrNotAClosure               = NewStaticError("not a closure")
	ErrUnknownCharacterMnemonic  = NewStaticError("unknown character mnemonic")
	ErrNotAnInteger              = NewStaticError("not an integer")
	ErrNotALocalEnvironmentFrame = NewStaticError("not a local environment frame")
	ErrNotAMachineTemplate       = NewStaticError("not a machine template")
	ErrUnexpectedNil             = NewStaticError("unexpected nil value")
	ErrUnexpectedTransformer     = NewStaticError("unexpected transformer")
	ErrNotAString                = NewStaticError("not a string")
	ErrNotAVector                = NewStaticError("not a vector")
	ErrNotAByteVector            = NewStaticError("not a bytevector")
	ErrNotAProcedure             = NewStaticError("not a procedure")
	ErrNotAParameter             = NewStaticError("not a parameter")
	ErrNotAStringOutputPort      = NewStaticError("not a string output port")
	ErrNotABytevectorOutputPort  = NewStaticError("not a bytevector output port")
	ErrNotANativeError           = NewStaticError("not an error object")
	ErrNotARecord                = NewStaticError("not a record")
	ErrNotARecordType            = NewStaticError("not a record type")
	ErrFileNotFound              = NewStaticError("file not found")
	ErrFileOpen                  = NewStaticError("file open failed")
	ErrLibraryNotFound           = NewStaticError("library not found")
	ErrCircularDependency        = NewStaticError("circular library dependency")
	ErrUnexportedIdentifier      = NewStaticError("identifier not exported")

	// Threading errors
	ErrNotAThread              = NewStaticError("not a thread")
	ErrNotAMutex               = NewStaticError("not a mutex")
	ErrNotAConditionVariable   = NewStaticError("not a condition variable")
	ErrNotATime                = NewStaticError("not a time")
	ErrNotAChannel             = NewStaticError("not a channel")
	ErrNotAWaitGroup           = NewStaticError("not a wait-group")
	ErrNotARWMutex             = NewStaticError("not a rw-mutex")
	ErrNotAOnce                = NewStaticError("not a once")
	ErrNotAnAtomic             = NewStaticError("not an atomic")
	ErrPortClosed              = NewStaticError("port is closed")
	ErrNotAHashtable           = NewStaticError("not a hashtable")
	ErrNoCaptureContext        = NewStaticError("no capture context for expansion")
	ErrExactnessConversion     = NewStaticError("exactness conversion failed")
	ErrInvalidFormat           = NewStaticError("invalid number format")
	ErrUnknownOpCode           = NewStaticError("unknown op code")
	ErrNotAMatch               = NewStaticError("not a match")
	ErrNotAPromptTag           = NewStaticError("not a prompt tag")
	ErrNotAContinuationMarkSet = NewStaticError("not a continuation mark set")
	ErrNotAContinuation        = NewStaticError("not a continuation")
	ErrTypeConversion          = NewStaticError("type conversion failed")
	ErrIndexOutOfRange         = NewStaticError("index out of range")
	ErrImmutableString         = NewStaticError("cannot mutate immutable string")

	// FFI errors
	ErrFFIRegistration          = NewStaticError("FFI registration error")
	ErrFFICallbackError         = NewStaticError("FFI callback error")
	ErrCallbackResultConversion = NewStaticError("callback result conversion failed")
	ErrHashtableInsertionFailed = NewStaticError("hashtable insertion failed")

	// Engine initialization errors
	ErrEngineInit = NewStaticError("engine initialization error")

	// Pipeline errors (expansion, compilation, runtime phases)
	ErrExpansion   = NewStaticError("expansion error")
	ErrCompilation = NewStaticError("compilation error")

	// Environment errors (keep as panics but use sentinels)
	ErrMissingNamespace     = NewStaticError("missing Namespace")
	ErrMissingPhaseRegistry = NewStaticError("missing PhaseRegistry")
	ErrNilParentEnvironment = NewStaticError("nil parent environment")

	// Panic recovery errors
	ErrThreadPanic   = NewStaticError("thread panic")
	ErrPanicRecovery = NewStaticError("panic recovery")

	// Syntax errors
	ErrCannotDoubleSyntaxWrap  = NewStaticError("cannot wrap syntax value in SyntaxObject")
	ErrNoMatchingClause        = NewStaticError("no matching clause")
	ErrUnsupportedTransformer  = NewStaticError("unsupported transformer")
	ErrLibraryConfiguration    = NewStaticError("library configuration error")
	ErrLibraryFormMalformed    = NewStaticError("malformed library form")
	ErrLibraryNameMismatch     = NewStaticError("library name mismatch")
	ErrHashtableKeyNotFound    = NewStaticError("hashtable key not found")
	ErrAllocationLimitExceeded = NewStaticError("allocation limit exceeded")
	ErrNonContinuableException = NewStaticError("non-continuable exception")

	// Recursion depth
	ErrCallDepthExceeded     = NewStaticError("call depth exceeded")
	ErrContinuationUnderflow = NewStaticError("continuation underflow")

	// Escape continuations
	ErrExpiredEscape       = NewStaticError("expired escape procedure")
	ErrContinuationBarrier = NewStaticError("continuation barrier violation")

	// Utility errors (keep as panic)
	ErrRandomGenerationFailed = NewStaticError("random generation failed")
	ErrInvalidLoadPath        = NewStaticError("invalid load path")

	// Channel errors
	ErrChannelClosed = NewStaticError("channel is closed")

	// Process errors
	ErrNotAProcess = NewStaticError("not a process")

	// Thread errors
	ErrJoinTimeout             = NewStaticError("thread-join!: timeout")
	ErrThreadAlreadyStarted    = NewStaticError("thread-start!: thread already started")
	ErrCrossThreadContinuation = NewStaticError("cannot invoke continuation from different thread")
)

Standard error values for type checking and runtime errors.

Functions

This section is empty.

Types

type ForeignError

type ForeignError struct {
	// contains filtered or unexported fields
}

ForeignError is an error type for Go primitive implementations (functions foreign to Scheme). It wraps an optional underlying error with a message.

func NewForeignErrorf

func NewForeignErrorf(msg string, vs ...any) *ForeignError

NewForeignErrorf creates a new foreign error with a formatted message.

func WrapForeignErrorWithCause

func WrapForeignErrorWithCause(sentinel, cause error, msg string, vs ...any) *ForeignError

WrapForeignErrorWithCause wraps a sentinel and a root cause into a single ForeignError. The sentinel is matched by errors.Is for programmatic dispatch; the cause preserves the underlying failure for diagnostics.

func WrapForeignErrorf

func WrapForeignErrorf(err error, msg string, vs ...any) *ForeignError

WrapForeignErrorf wraps an existing error with a formatted message.

func (*ForeignError) As

func (p *ForeignError) As(target any) bool

As checks whether the sentinel or cause can be assigned to target.

func (*ForeignError) Cause

func (p *ForeignError) Cause() error

Cause returns the root cause error, if any. Useful for debugging/logging when you need the underlying failure directly.

func (*ForeignError) Error

func (p *ForeignError) Error() string

func (*ForeignError) Is

func (p *ForeignError) Is(target error) bool

Is reports whether target matches the sentinel or the cause. This replaces Unwrap and gives ForeignError precise two-chain semantics: the sentinel identifies the error category, the cause preserves the root failure from the underlying operation.

type ForeignFileError

type ForeignFileError struct {
	*ForeignError
	Filename string // the file path that caused the error
	Op       string // the operation (e.g., "open-input-file", "delete-file")
}

ForeignFileError represents an error from a file system operation. R7RS §6.11: detected by file-error? predicate.

func WrapForeignFileError

func WrapForeignFileError(err error, op string, filename string) *ForeignFileError

WrapForeignFileError wraps an OS error with file context.

type ForeignProcessError added in v1.9.1

type ForeignProcessError struct {
	*ForeignError
	Command string // the command that was run
	Op      string // the operation (e.g., "process-spawn", "system")
}

ForeignProcessError represents an error from a process operation. Parallel to ForeignFileError for programmatic inspection of failed process operations.

func WrapForeignProcessError added in v1.9.1

func WrapForeignProcessError(err error, op string, command string) *ForeignProcessError

WrapForeignProcessError wraps an OS error with process context.

type ForeignReadError

type ForeignReadError struct {
	*ForeignError
}

ForeignReadError represents an error from a read or parse operation. R7RS §6.11: detected by read-error? predicate.

func NewForeignReadErrorf

func NewForeignReadErrorf(msg string, vs ...any) *ForeignReadError

NewForeignReadErrorf creates a new read error with a formatted message.

func WrapForeignReadErrorf

func WrapForeignReadErrorf(err error, msg string, vs ...any) *ForeignReadError

WrapForeignReadErrorf wraps an error as a read error.

type StaticError

type StaticError struct {
	// contains filtered or unexported fields
}

StaticError is a sentinel error type for programmatic matching via errors.Is. Each sentinel carries a fixed human-readable message and serves as a stable identity that callers can match across error wrapping layers.

func NewStaticError

func NewStaticError(msg string) *StaticError

NewStaticError creates a new static error with the given message.

func (*StaticError) Error

func (p *StaticError) Error() string

Jump to

Keyboard shortcuts

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