Categorygithub.com/weathersource/go-errors
modulepackage
1.0.5
Repository: https://github.com/weathersource/go-errors.git
Documentation: pkg.go.dev

# README

go-errors

CircleCI GoDoc |

Package errors is a robust and easy-to-use error package. It supports verbosity levels, maintains causal errors, implements stack tracing, maps to common HTTP error codes, exposes temporary and timeout errors, implements JSON marshalling, and is GRPC compatible.

This package started github.com/goware/errorx and grew from there.

Supported errors are as follows:

Error | HTTP Code | Description

AbortedError | 409 CONFLICT | operation was aborted AlreadyExistsError | 409 CONFLICT | attempt to create an entity failed because one already exists CanceledError | 499 CLIENT CLOSED REQUEST | operation was canceled DataLossError | 500 INTERNAL SERVER ERROR | unrecoverable data loss or corruption DeadlineExceededError | 504 GATEWAY TIMEOUT | operation expired before completion FailedPreconditionError | 400 BAD REQUEST | operation rejected because system is not in a state required for operation's execution InternalError | 500 INTERNAL SERVER ERROR | some invariants expected by underlying system has been broken InvalidArgumentError | 400 BAD REQUEST | client specified an invalid argument NotFoundError | 404 NOT FOUND | requested entity was not found NotImplementedError | 501 NOT IMPLEMENTED | operation is not implemented OutOfRangeError | 400 BAD REQUEST | operation was attempted past the valid range NewPassthroughError | varies | passes 400 errors directly, 500 errors are mapped to InternalError PermissionDeniedError | 403 FORBIDDEN | the caller does not have permission to execute the specified operation ResourceExhaustedError | 429 TOO MANY REQUESTS | some resource has been exhausted UnauthenticatedError | 401 UNAUTHORIZED | the request does not have valid authentication credentials UnavailableError | 503 SERVICE UNAVAILABLE | the service is currently unavailable UnknownError | 500 INTERNAL SERVER ERROR | unknown server error

# Functions

NewAbortedError returns a new AbortedError.
NewAlreadyExistsError returns a new AlreadyExistsError.
NewCanceledError returns a new CanceledError.
NewDataLossError returns a new DataLossError.
NewDeadlineExceededError returns a new DeadlineExceededError.
NewErrors returns an error that consists of multiple errors.
NewFailedPreconditionError returns a new FailedPreconditionError.
NewInternalError returns a new InternalError.
NewInvalidArgumentError returns a new InvalidArgumentError.
NewNotFoundError returns a new NotFoundError.
NewNotImplementedError returns a new NotImplementedError.
NewOutOfRangeError returns a new OutOfRangeError.
NewPassthroughError handles an error from an external dependency.
NewPermissionDeniedError returns a new PermissionDeniedError.
NewResourceExhaustedError returns a new ResourceExhaustedError.
NewUnauthenticatedError returns a new UnauthenticatedError.
NewUnavailableError returns a new UnavailableError.
NewUnknownError returns a new UnknownError.
SetVerbosity changes global verbosity setting.

# Constants

Constants for use with SetVerbosity(...).
Constants for use with SetVerbosity(...).
Constants for use with SetVerbosity(...).
Constants for use with SetVerbosity(...).

# Structs

AbortedError indicates the operation was aborted, typically due to a concurrency issue like sequencer check failures, transaction aborts, etc.
AlreadyExistsError means an attempt to create an entity failed because one already exists.
CanceledError indicates the operation was canceled (typically by the caller).
DataLossError indicates unrecoverable data loss or corruption.
DeadlineExceededError means operation expired before completion.
Errors is a container for multiple errors and implements the error interface.
FailedPreconditionError indicates operation was rejected because the system is not in a state required for the operation's execution.
InternalError means some invariants expected by underlying system has been broken.
InvalidArgumentError indicates client specified an invalid argument.
NotFoundError means some requested entity (e.g., file or directory) was not found.
NotImplementedError indicates operation is not implemented or not supported/enabled in this service.
OutOfRangeError means operation was attempted past the valid range.
PermissionDeniedError indicates the caller does not have permission to execute the specified operation.
ResourceExhaustedError indicates some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.
UnauthenticatedError indicates the request does not have valid authentication credentials for the operation.
UnavailableError indicates the service is currently unavailable.
UnknownError is an unknown server error.