shark

package module
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: May 22, 2019 License: MIT Imports: 0 Imported by: 0

README

Shark

Shark is a set of tools for handling errors and panics in Go.

Installation

go get -u github.com/Kamva/shark

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PanicIfError added in v0.1.1

func PanicIfError(err error)

PanicIfError panic exception if the given error is not nil

func PanicIfErrorWithMessage added in v0.1.1

func PanicIfErrorWithMessage(err error, message string)

PanicIfErrorWithMessage panic with custom message if given error is not nil

Types

type ErrorBag

type ErrorBag struct {
	// contains filtered or unexported fields
}

ErrorBag is a error container

func NewErrorBag added in v0.2.1

func NewErrorBag() ErrorBag

NewErrorBag return new instance of error bag object.

func (ErrorBag) Append

func (b ErrorBag) Append(key string, value string)

Append add new error for key

func (ErrorBag) GetErrors

func (b ErrorBag) GetErrors() map[string][]string

GetErrors returns all errors of all keys

func (ErrorBag) Map added in v0.2.0

func (b ErrorBag) Map(function ErrorBagMapper) ErrorBag

Map accepts a mapper function and run it in every errors slice and return new error bag.

func (ErrorBag) Merge added in v0.2.2

func (b ErrorBag) Merge(errorBag ErrorBag) ErrorBag

Merge merge current error bag with given error bag and return the merged one.

type ErrorBagMapper added in v0.2.0

type ErrorBagMapper func([]string) []string

ErrorBagMapper is a function type that accept errors of a field, process theme, and then return the processed errors.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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