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 Ignore(format string, a ...interface{}) error
- func Input(fields map[string]string, format string, a ...interface{}) error
- func InputFields(e error) (map[string]string, bool)
- func InvalidParam(format string, a ...interface{}) error
- func IsBadRequest(e error) bool
- func IsConfig(err error) bool
- func IsDefer(err error) bool
- func IsIgnore(err error) bool
- func IsInput(e error) bool
- func IsInvalidParam(err error) bool
- func IsNotFound(err error) bool
- func IsServer(err error) bool
- func IsShutdown(e error) bool
- func IsSystem(err error) bool
- func IsValidation(err error) bool
- 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 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 ToIgnore(e error, format string, a ...interface{}) error
- func ToInvalidParam(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 ToValidation(e error, format string, a ...interface{}) error
- func Validation(format string, a ...interface{}) error
- func Wrap(err error, msg string, a ...interface{}) error
- type InputOpts
Constants ¶
const ( SystemMsg = "system failure" ServerMsg = "server failure" NotFoundMsg = "not found failure" 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" InputMsg = "invalid input" DefaultInputSeparator = ":" DefaultInputItemSeparator = "," )
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 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 InvalidParam ¶ added in v0.4.0
InvalidParam is to indicate that the param of a function or any parameter in general is invalid
func IsBadRequest ¶ added in v0.6.0
func IsInvalidParam ¶ added in v0.4.0
func IsNotFound ¶
func IsShutdown ¶ added in v0.5.0
func IsValidation ¶
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 ToBadRequest ¶ added in v0.6.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 ToInvalidParam ¶ added in v0.4.0
func ToNotFound ¶
func ToShutdown ¶ added in v0.5.0
func ToValidation ¶
func Validation ¶
Validation is used to signify that a validation rule as been violated