safetynet

package module
v0.0.0-...-35d72c7 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2025 License: MIT Imports: 4 Imported by: 0

README

SafetyNet

func DoSomething() (err error) {
    defer safetynet.Rescue(&err)

    ...
    panic("Ta-da!") // catched by safetynet.Rescue and converted to PanicError.
    ...
}

err := DoSomething()         // err -> PanicError (includeing "Ta-da!")
fmt.Println(err.Error())     // panic: Ta-da!

fmt.Println(err)             // message with traces

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Rescue

func Rescue(err *error)

Types

type PanicError

type PanicError struct {
	Callstack stack.CallStack
	// contains filtered or unexported fields
}

func NewPanicError

func NewPanicError(v any) PanicError

func (PanicError) Error

func (e PanicError) Error() string

func (PanicError) Format

func (e PanicError) Format(s fmt.State, verb rune)

func (PanicError) MarshalJSON

func (e PanicError) MarshalJSON() ([]byte, error)

func (PanicError) String

func (e PanicError) String() 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