multierror

package
v0.0.0-...-bcea9b7 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: MIT Imports: 1 Imported by: 0

README

Usage

MultiError concatenate errors into one error.

Example

package main 

import (
	"github.com/donutloop/toolkit/multierror"
	"fmt"
)

func main() {
    errs := []error{
		errors.New("error connect to db failed"),
		errors.New("error marschaling json"),
    }
    fmt.Println(multierror.New(errs...))
}

Documentation

Overview

Example
errs := []error{
	ErrConnection,
	ErrMarshal,
}
fmt.Println(multierror.New(errs...))
Output:

multiple errors: error connect to db failed; error marshal json

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(errs ...error) error

New concatenate errors into one. If all errors are nil then it will returns nil otherwise the return value is a MultiError containing all the non-nil error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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