Categorygithub.com/lcnascimento/go-kit/errors
modulepackage
1.6.0
Repository: https://github.com/lcnascimento/go-kit.git
Documentation: pkg.go.dev

# README

Errors Package

Lib designed to facilitate and standardize how error handling should be done.

It produces CustomError, that encodes useful information about a given error.

It's supposed to flow within the application in detriment of the the default golang error since its Kind and Code attributes are the keys to express its semantic and uniqueness, respectively.

It should be generated once by the peace of code that found the error (because it's where we have more context about the error), and be by passed to the upper layers of the application.

# Functions

As finds the first error in err's tree that matches target, and if one is found, sets target to that error value and returns true.
Code retrieves the first non unknown Code in err's tree.
Is reports whether any error in err's tree matches target.
IsRetryable reports whether any error in err's tree is retryable.
Kind retrieves the first non unknown Kind in err's tree.
New returns a new instance of CustomError with the given message.
NewMissingRequiredDependency creates a new error that indicates a missing required dependency.
NewValidationError creates a Validation error.
Unwrap retrieves all the errors that forms the baseline for the given one.
Wrap adds more contextual information into the given error.

# Constants

CodeUnknown is the default code returned when the application doesn't attach any code into the error.
KindConflict are errors caused by requests with data that conflicts with the current state of the system.
KindInternal are errors caused by some internal fail like failed IO calls or invalid memory states.
KindInvalidInput are errors caused by some invalid values on the input.
KindNotFound are errors caused by any required resources that not exists on the data repository.
KindResourceExhausted indicates some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.
KindUnauthenticated are errors caused by an unauthenticated call.
KindUnauthorized are errors caused by an unauthorized call.
KindUnknown is the default kind returned when the application doesn't attach any kind into the error.

# Variables

ErrMock is a fake mocked that should be used in test scenarios.
ErrNotImplemented indicates that a given feature is not implemented yet.
ErrResourceNotFound indicates that a desired resource was not found.

# Structs

CustomError is a structure that encodes useful information about a given error.

# Type aliases

CodeType is a string that contains error's code description.
KindType is a string that contains error's kind description.