/zerrors

Error primitives package

Primary LanguageGoMIT LicenseMIT

Zerrors

A error primitives package with a list of grpc based errors that can be used to describe root causes.

Originally forked and extracted from Zitadel zerrors package: Zitadel Errors

Install

go get github.com/mscno/zerrors

This will install the base zerrors package and as well as the httperrors adapter.

If you want to use the grpc adapter, you will need to install the zerrors-grpc package:

go get github.com/mscno/zerrors/grpczerrors

Usage

Basic Usage

package main

import (
    "fmt"
    "github.com/mscno/zerrors"
)

func main() {
	rooterr := fmt.Errorf("root error")
    err := zerrors.ThrowNotFound(rooterr,"NOT_FOUND","my error")
    fmt.Println(err)
}