v0.4.5 Latest Latest

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

Go to latest
Published: Jul 24, 2020 License: MIT Imports: 2 Imported by: 7




This section is empty.


This section is empty.


func Ensure

func Ensure(err error, message string)

Ensure checks for an error. If there is one it panics, if no error it prints the message (given it is not empty) `message` should describe what is ensured by the call and verification of `err` being `nil`

func LogIfError

func LogIfError(err error)

LogIfError logs an error if it occurs, rather than repeating this structure everywhere

func PanicIfErr

func PanicIfErr(err error, customMessage string)

PanicIfErr panics in case of an error. If custom message it creates a new error based on that and returns that instead

func ReturnErrOnPanic

func ReturnErrOnPanic(perr *error) func()

ReturnErrOnPanic catches panics, expects them to be of type error, then stores it in the pointer as recovery

func ReturnFirstErr

func ReturnFirstErr(errs ...error) error

ReturnFirstErr returns the first not-nil error from a list of errors. Used to prevent many copies of if err != nil { return err } when they are indepedent


This section is empty.

Jump to

Keyboard shortcuts

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