Simplifies error handling boilerplate in Golang
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE.txt
README.md
exit.go

README.md

Nifty error handling for Golang

Go Report Card

This library provides helper methods to dry up repetitive boilerplate around error checking in Golang.

Instead of:

import "log"

if err != nil {
  log.Fatal(err)
}

you can write:

import "github.com/Originate/exit"

exit.If(err)

The IfWrap and IfWrapf functions wrap the given error into the given error message using errors.Wrap and errors.Wrapf:

exit.IfWrap(err, "something went wrong")
exit.IfWrapf(err, "%s", message)

Installation

go get github.com/Originate/exit