package
0.0.0-20200807125606-b3493662e4bf
Repository: https://github.com/thethingsnetwork/go-utils.git
Documentation: pkg.go.dev

# Functions

Cause returns the cause of an error.
Descriptor returns the error descriptor from any error.
Format formats the values into the provided string.
From lifts an error to be and Error.
FromGRPC parses a gRPC error and returns an Error.
FromHTTP parses the http.Response and returns the corresponding If the response is not an error (eg.
Get returns an error descriptor based on an error code.
GetAll returns all registered error descriptors.
GetAttributes returns the error attributes or falls back to empty attributes.
GetCode infers the error code from the error.
GetMessageFormat infers the message format from the error or falls back to the error message.
GetType infers the error type from the error or falls back to Unknown.
GRPCCode returns the corresponding http status code from an error.
GRPCCodeToType converts the gRPC error code to an error type or returns the Unknown type if not possible.
HTTPStatusCode returns the HTTP status code for the given error or 500 if it doesn't know.
HTTPStatusToType infers the error Type from a HTTP Status code.
New creates a new Error from a descriptor and some attributes.
Range is a utility function that creates a code builder.
Register registers a new error descriptor.
ToGRPC turns an error into a gRPC error.
ToHTTP writes the error to the http response.

# Constants

AlreadyExists is the type of errors that result from a conflict where the updated/created entity already exists.
Canceled indicates the operation was canceled (typically by the caller).
CodeHeader is the header where the error code will be stored.
Conflict is the type of errors that result from a conflict.
Internal is the type of internal errors.
InvalidArgument is the type of errors that result from an invalid argument in a request.
NoCode is a missing code.
NotFound is the type of errors that result from an entity that is not found or not accessible.
NotImplemented is the type of errors that result from a requested action that is not (yet) implemented.
OutOfRange is the type of errors that result from an out of range request.
PermanentlyUnavailable is the type of errors that result from an action that has been deprecated and is no longer available.
PermissionDenied is the type of errors where the request was authorized but did not grant access to the requested entity.
ResourceExhausted indicates some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.
TemporarilyUnavailable is the type of errors that result from a service being temporarily unavailable (down).
Timeout is the type of errors that are a result of a process taking too long to complete.
Unauthorized is the type of errors where the request is unauthorized where it should be.
Unknown is the type of unknown or unexpected errors.

# Structs

ErrDescriptor is a helper struct to easily build new Errors from and to be the authoritive information about error codes.

# Interfaces

Causer is the type of errors that can have a cause.
Error is the interface of portable errors.

# Type aliases

Attributes is a map of attributes.
Code represents a unique error code.
Type is the type of an error which, much like gRPC Codes or HTTP Status Codes, denotes what category an error belongs to and how to handle it.