Documentation ¶
Overview ¶
Package errors is an extension of and drop in replacement for the standard library errors package. Multiple errors can be composed into a single error, and single errors can be extended with new errors or with context. You can also check whether any of the extensions or compositions contains a certain error, allowing for more flexible error handling for complex processes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddContext ¶
AddContext will add a string context to an error if the error is not nil. If the error is nil, then nil will be returned regardless of the context.
func Compose ¶
Compose will compose all errors together into a single error, remembering each component error so that they can be checked for matches later using the `Contains` function.
Any `nil` input errors will be ignored. If all input errors are `nil`, then `nil` will be returned.
func Contains ¶
Contains will check whether the base error contains the cmp error. If the base err is a Error, then it will check whether there is a match on any of the underlying errors.
func Extend ¶
Extend will extend the first error with the second error, remembering each component error so that they can be checked for matches later using the `Contains` function.
Any `nil` input will be ignored. If both inputs are `nil, then `nil` will be returned.
func IsOSNotExist ¶
IsOSNotExist returns true if any of the errors in the underlying composition return true for os.IsNotExist.