Multiple errors as only one

Use a single error as a list of multiple errors. It is fully compatible with the standard GO error.

Multiple

Multiple(error)*Multiple

Return a multiple interface to manage multiple errors.

Add

(*Multiple)Add(..errors)error

Add a list of errors to an existing error. It can be a single error or another list of errors.

package main

import (
  "fmt"
  "github.com/oxequa/grace"
)

func main() {
  err := grace.New("test")
  err = grace.Multi(err).Add(grace.New("test"), grace.New("test1"))
  fmt.Println(err)
}

Get

(*Recovery)Get()[]error

Get only the stack trace without error.

package main

import (
  "fmt"
  "github.com/oxequa/grace"
)

func main() {
  err := grace.New("test")
  err = grace.Multi(err).Add(grace.New("test"), grace.New("test1"))
  fmt.Println(err)
  fmt.Println(grace.Multi(err).Get())
}