Documentation
¶
Overview ¶
Package errz provides highlevel error handling helpers
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fatalf ¶
FatalF adds a stack trace and an addtional message using printf semantics to the error and panics.
func Log ¶
func Log(err error)
Log an error + stack trace to the underlying logger. Usually used at the top level of a application to log errors without handling them.
func Recover ¶
func Recover(errs ...*error)
Recover recovers a panic usually introduced by Fatal or a memory corruption. In the case of a plain error Recover decorates the error with a stacktrace. When a error pointer is passed `Recover(&err) the error is writted to the error pointer, and therefore returned to the calling function. In the case of `Recover()` called without args the error is logged to the underlying logr implementation.
Example:
func myfunc() (err error) { defer errz.Recover(&err) ... ... }
func WithLogger ¶
WithLogger set a package wide logger. Take a look at https://github.com/go-logr/logr for a list of popular logger implemetations.
Types ¶
This section is empty.