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

# README

Errors Package

Lib designed to facilitate and standardize how error handling should be done inside Trivela's systems.

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

Kind this method receives an error, then compares its interface type with the CustomError interface.
Kind this method receives an error, then compares its interface type with the CustomError interface.
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.
RootError tries to convert the given error into a CustomError.

# 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.
KindUnexpected 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.