multierror

package module
v0.0.0-...-633a035 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 3 Imported by: 4

README

Multierror

multierror is a simple go package that allows you to combine and present multiple errors as a single error.

How to use

import "github.com/cloudfoundry/multierror"

errors := multierror.MultiError{}

err1 := FirstFuncThatReturnsError()
err2 := SecondFuncThatReturnsError()

errors.Add(err1)
errors.Add(err2)

//You can also add multierror structs and they will be flattened into one struct
errors2 := multierror.MultiError()
errors2.Add(err1)
errors.Add(errors2)


//Returns the errors as an aggregate of all the error messages
errors.Error()

Development

Dependencies

This repository's dependencies are managed using routing-release. Please refer to documentation in that repository for setting up tests

Executables
  1. bin/test.bash: This file is used to run test in Docker & CI. Please refer to Dependencies for setting up tests.
Reporting issues and requesting features

Please report all issues and feature requests in cloudfoundry/routing-release.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultiError

type MultiError struct {
	Message string
	Errors  []*MultiError
	// contains filtered or unexported fields
}

func NewMultiError

func NewMultiError(message string) *MultiError

func (*MultiError) Add

func (m *MultiError) Add(e error)

func (*MultiError) Error

func (m *MultiError) Error() string

func (*MultiError) Length

func (m *MultiError) Length() int

Jump to

Keyboard shortcuts

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