Documentation
¶
Overview ¶
Package failure implements an opaque error pattern based several of the most common types of errors that occur when developing microservices.
Index ¶
- Constants
- func BadRequest(format string, a ...interface{}) error
- func Config(format string, a ...interface{}) error
- func Defer(format string, a ...interface{}) error
- func Forbidden(format string, a ...interface{}) error
- func Ignore(format string, a ...interface{}) error
- func IgnoreRetry(format string, a ...interface{}) error
- func InvalidParam(format string, a ...interface{}) error
- func IsAnyAuthFailure(e error) bool
- func IsBadRequest(e error) bool
- func IsConfig(e error) bool
- func IsDefer(e error) bool
- func IsForbidden(e error) bool
- func IsIgnore(e error) bool
- func IsIgnoreRetry(e error) bool
- func IsInvalidParam(e error) bool
- func IsNoMoreRetries(e error) bool
- func IsNotAuthenticated(e error) bool
- func IsNotAuthorized(e error) bool
- func IsNotFound(e error) bool
- func IsServer(err error) bool
- func IsShutdown(e error) bool
- func IsSystem(err error) bool
- func IsTimeout(e error) bool
- func IsValidation(e error) bool
- func NoMoreRetries(format string, a ...interface{}) error
- func NotAuthenticated(format string, a ...interface{}) error
- func NotAuthorized(format string, a ...interface{}) error
- func NotFound(format string, a ...interface{}) error
- func Server(format string, a ...interface{}) error
- func Shutdown(format string, a ...interface{}) error
- func System(format string, a ...interface{}) error
- func Timeout(format string, a ...interface{}) error
- func ToBadRequest(e error, format string, a ...interface{}) error
- func ToConfig(e error, format string, a ...interface{}) error
- func ToDefer(e error, format string, a ...interface{}) error
- func ToForbidden(e error, format string, a ...interface{}) error
- func ToIgnore(e error, format string, a ...interface{}) error
- func ToIgnoreRetry(e error, format string, a ...interface{}) error
- func ToInvalidParam(e error, format string, a ...interface{}) error
- func ToNoMoreRetries(e error, format string, a ...interface{}) error
- func ToNotAuthenticated(e error, format string, a ...interface{}) error
- func ToNotAuthorized(e error, format string, a ...interface{}) error
- func ToNotFound(e error, format string, a ...interface{}) error
- func ToServer(e error, format string, a ...interface{}) error
- func ToShutdown(e error, format string, a ...interface{}) error
- func ToSystem(e error, format string, a ...interface{}) error
- func ToTimeout(e error, format string, a ...interface{}) error
- func ToValidation(e error, format string, a ...interface{}) error
- func UnwrapIgnoreRetry(e error) error
- func Validation(format string, a ...interface{}) error
- func Wrap(err error, msg string, a ...interface{}) error
- func WrapIgnoreRetry(e error) error
Constants ¶
const ( SystemMsg = "system failure" ServerMsg = "server failure" NotFoundMsg = "not found failure" NotAuthorizedMsg = "not authorized failure" NotAuthenticatedMsg = "not authenticated failure" ForbiddenMsg = "access is forbidden" ValidationMsg = "validation failure" DeferMsg = "failure occurred inside defer" IgnoreMsg = "ignore failure" ConfigMsg = "config failure" InvalidParamMsg = "invalid param failure" ShutdownMsg = "system shutdown failure" BadRequestMsg = "bad request" TimeoutMsg = "timeout failure" NoMoreRetriesMsg = "retry limit reached" )
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶ added in v0.6.0
BadRequest is used to signal that the app should shut down.
func Config ¶ added in v0.3.0
Config is used to signify that error occurred when processing the application configuration
func Forbidden ¶ added in v0.7.0
Forbidden is used to signify either not authenticated or not authorized
func Ignore ¶
Ignore is used to signify that error should not be acted on, it's up to the handler to decide to log these errors or not.
func IgnoreRetry ¶ added in v0.8.0
IgnoreRetry is used to signal that this operation should not be retried. Useful in http client middleware that provides operations that are mixed into retry or backoff functions
func InvalidParam ¶ added in v0.4.0
InvalidParam is to indicate that the param of a function or any parameter in general is invalid
func IsAnyAuthFailure ¶ added in v0.7.0
IsAnyAuthFailure can be used to determine if any of the following we used: NotAuthenticated, NotAuthorized, Forbidden
func IsBadRequest ¶ added in v0.6.0
func IsForbidden ¶ added in v0.7.0
func IsIgnoreRetry ¶ added in v0.8.0
func IsInvalidParam ¶ added in v0.4.0
func IsNoMoreRetries ¶ added in v0.8.0
func IsNotAuthenticated ¶ added in v0.7.0
func IsNotAuthorized ¶ added in v0.7.0
func IsNotFound ¶
func IsShutdown ¶ added in v0.5.0
func IsValidation ¶
func NoMoreRetries ¶ added in v0.8.0
NoMoreRetries is used to signal all available retries have been used up
func NotAuthenticated ¶ added in v0.7.0
NotAuthenticated is used to signify that a resource's identity verification failed. They are not who they claim to be
func NotAuthorized ¶ added in v0.7.0
NotAuthorized is used to signify that a resource does not have sufficient access to perform a given task
func NotFound ¶
NotFound is used to signify that whatever resource you were looking for does not exist and that fact it does not exist is an error.
func Server ¶
Server has the same meaning as Platform or System, it can be used instead if you don't like how Platform or System reads in your code.
func System ¶
System is has the same meaning as Platform or Server, it can be used instead if you don't like how Platform reads in your code
func Timeout ¶ added in v0.8.0
Timeout is used to signify that error because something was taking too long
func ToBadRequest ¶ added in v0.6.0
func ToForbidden ¶ added in v0.7.0
func ToIgnore ¶
ToIgnore converts `e` into the root cause of ignoreErr, it informs the system to ignore error. Used typically to log results and do not act on the error itself.
func ToIgnoreRetry ¶ added in v0.8.0
func ToInvalidParam ¶ added in v0.4.0
func ToNoMoreRetries ¶ added in v0.8.0
func ToNotAuthenticated ¶ added in v0.7.0
func ToNotAuthorized ¶ added in v0.7.0
func ToNotFound ¶
func ToShutdown ¶ added in v0.5.0
func ToValidation ¶
func UnwrapIgnoreRetry ¶ added in v0.8.0
func Validation ¶
Validation is used to signify that a validation rule as been violated
func WrapIgnoreRetry ¶ added in v0.8.0
Types ¶
This section is empty.