Skip to content

arquivei/errors

Repository files navigation

errors

A golang package to create useful errors.

Using the errors package

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"),
	)
}

About

A golang package to handle errors.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages