goadapt

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: LGPL-2.1 Imports: 6 Imported by: 47

README

goadapt

Use the Ck/Return pattern from this package to replace the common if err != nil {return err} boilerplate.

  • Allows shorter, more readable code.
  • Provides more descriptive error messages.
  • Includes file name and line number in error strings by default.
  • Allows optional per-error and per-function annotations.
  • Allows optional format strings for annotations.

Inspired in part by Dave Cheney's https://github.com/pkg/errors and Harri Lainio's https://github.com/lainio/err2.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(cond bool, args ...interface{})

func Ck

func Ck(err error, args ...interface{})

func ExitIf added in v0.0.5

func ExitIf(err, target error, args ...interface{})

func Halt added in v0.0.8

func Halt(rc *int, msg *string)

convert panic(exitErr) into returned rc and msg

func Info

func Info(msg interface{}, args ...interface{})

func Return

func Return(err *error, args ...interface{})

convert panic into returned err see https://github.com/lainio/err2 and https://blog.golang.org/go1.13-errors

func Uerr

func Uerr(msg interface{}, args ...interface{})

Types

This section is empty.

Jump to

Keyboard shortcuts

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