Documentation
¶
Overview ¶
Package panicerr makes it easy to recover panics, and convert them to standard errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Recover ¶
func Recover(err *error)
Recover wraps the recover() built in, and is meant to be called in a defer statement. If a panic is recovered, it is converted to an error, with pkg/errors-compatible stack trace, and assigned to err.
Example:
func DoSomething() (err error) {}
defer panicerr.Recover(&err)
// ... code that may panic
return nil
}
Types ¶
type StackTrace ¶
type StackTrace = errors.StackTrace
StackTrace is an alias to pkg/errors.StackTrace
Click to show internal directories.
Click to hide internal directories.