ftag

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2025 License: MIT Imports: 1 Imported by: 84

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func With

func With(k Kind) func(error) error

With implements the Fault Wrapper interface.

func Wrap

func Wrap(parent error, k Kind) error

Wrap wraps an error and gives it a distinct tag.

Types

type Kind

type Kind string

Kind is a simple string to describe the category of an error.

const (
	None             Kind = ""                  // Empty error.
	Internal         Kind = "INTERNAL"          // Internal errors. This means that some invariants expected by the underlying system have been broken. This error code is reserved for serious errors.
	Cancelled        Kind = "CANCELLED"         // The operation was cancelled, typically by the caller.
	InvalidArgument  Kind = "INVALID_ARGUMENT"  // The client specified an invalid argument.
	NotFound         Kind = "NOT_FOUND"         // Some requested entity was not found.
	AlreadyExists    Kind = "ALREADY_EXISTS"    // The entity that a client attempted to create already exists.
	PermissionDenied Kind = "PERMISSION_DENIED" // The caller does not have permission to execute the specified operation.
	Unauthenticated  Kind = "UNAUTHENTICATED"   // The request does not have valid authentication credentials for the operation.
)

func Get

func Get(err error) Kind

Get extracts the error tag of an error chain. If there's no tag, returns nil.

func GetAll added in v0.7.0

func GetAll(err error) []Kind

Jump to

Keyboard shortcuts

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