A golang package to create useful errors.
Import the package:
import (
"github.com/arquivei/errors"
)
Use errors.With()
:
func doStuff() error {
const op = errors.Op("doStuff")
err := fmt.Errorf("some error")
return errors.With(err,
errors.SeverityRuntime, op,
errors.Code("RUNTIME_ERROR"),
errors.KV("context1", "value1"),
errors.KV("context2", "value2"),
)
}