Discover Packages
github.com/donutloop/toolkit
multierror
package
Version:
v0.0.0-...-bcea9b7
Opens a new window with list of versions in this module.
Published: May 10, 2021
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
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...))
}
Expand ▾
Collapse ▴
Documentation
¶
errs := []error{
ErrConnection,
ErrMarshal,
}
fmt.Println(multierror.New(errs...))
Output:
multiple errors: error connect to db failed; error marshal json
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.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.