errkit

package
v0.2.15 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterReporter

func RegisterReporter(r ErrorReporter) error

RegisterReporter registers given reporter as global reporter. Returns an error if the reporter has already been registered.

func Report

func Report(err error)

Types

type Error

type Error string

Error type represents package level errors.

const (
	// ErrNotFound indicates that requested entity can not be found.
	ErrNotFound Error = "not found"

	// ErrAlreadyExists indicates an attempt to create an entity
	// which is failed because such entity already exists.
	ErrAlreadyExists Error = "already exists"

	// ErrInvalidArgument indicates that client has specified an invalid argument.
	ErrInvalidArgument Error = "invalid argument"

	// ErrUnauthenticated indicates the request does not have valid
	// authentication credentials to perform the operation.
	ErrUnauthenticated Error = "authentication failed"

	// ErrUnauthorized indicates the caller does not have permission to
	// execute the specified operation. It must not be used if the caller
	// cannot be identified (use ErrUnauthenticated instead for those errors).
	ErrUnauthorized Error = "permission denied"

	// ErrUnavailable indicates that the service is currently unavailable.
	// This kind of error is retryable. Caller should retry with a backoff.
	ErrUnavailable Error = "temporarily unavailable"

	// ErrConnFailed shows that connection to a resource failed.
	ErrConnFailed Error = "connection failed"
)

func (Error) Error

func (e Error) Error() string

type ErrorReporter

type ErrorReporter interface {
	Report(err error)
}

ErrorReporter reports about errors.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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