panics

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPanicHandler

func DefaultPanicHandler()

DefaultPanicHandler could be used as panic handler on top method like

defer panics.DefaultPanicHandler()

...to handle every panic in a better way.

func HandlePanicOfPresent

func HandlePanicOfPresent(framesToSkip int)

HandlePanicOfPresent could be used as panic handler on top method like

defer panics.HandlePanicOfPresent(2)

...to handle every panic in a better way.

Types

type Panic

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

Panic represents a go panic which could have a cause and a call stack.

func New

func New(message string, a ...interface{}) Panic

New creates a new Panic instance with the given message.

func (Panic) Cause

func (i Panic) Cause() interface{}

Cause returns the cause of this panic. If the result is nil there is no cause.

func (Panic) CausedBy

func (i Panic) CausedBy(what interface{}) Panic

CausedBy is a shortcut for Stack() for using in builder pattern.

func (Panic) Error

func (i Panic) Error() string

func (Panic) Message

func (i Panic) Message() string

Message returns the message of this panic.

func (Panic) Stack

func (i Panic) Stack() stack.Stack

Stack returns the call stack of this panic.

func (Panic) String

func (i Panic) String() string

func (Panic) Throw

func (i Panic) Throw()

Throw throws this panic.

Jump to

Keyboard shortcuts

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