xerrors

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package xerrors provides utilities for error handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Recover

func Recover(fn func() error) (err error)

Recover calls fn and returns a PanicError if fn panics.

If the panic originates directly within fn itself, it is not caught and propagates normally. This ensures that bugs in the engine's own closure logic are not silently swallowed.

func RecoverT

func RecoverT[T any](fn func() (T, error)) (v T, err error)

RecoverT calls fn and returns a PanicError if fn panics.

If the panic originates directly within fn itself, it is not caught and propagates normally. This ensures that bugs in the engine's own closure logic are not silently swallowed.

Types

type PanicError

type PanicError struct {
	Value      any
	StackTrace string
}

PanicError is an error that wraps a value recovered from a panic, along with the stack trace at the point of the panic.

func (PanicError) Error

func (e PanicError) Error() string

func (PanicError) Unwrap

func (e PanicError) Unwrap() error

Jump to

Keyboard shortcuts

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