Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
These aliased values are added to avoid conflicting imports of standard `errors` package and this `errors` package where these functions are needed.
var ( ErrInvalid = Error{Code: "bad_request", Message: "request is not valid"} ErrNotFound = Error{Code: "not_found", Message: "requested entity not found"} ErrConflict = Error{Code: "conflict", Message: "an entity with conflicting identifier exists"} ErrInternal = Error{Code: "internal_error", Message: "some unexpected error occurred"} ErrUnsupported = Error{Code: "unsupported", Message: "requested feature is not supported"} )
Common error categories. Use `ErrX.WithXXX()` to clone and add context.
Functions ¶
Types ¶
type Error ¶
type Error struct { Code string `json:"code"` Cause string `json:"cause,omitempty"` Message string `json:"message"` }
Error represents any error returned by the Entropy components along with any relevant context.
func (Error) Is ¶
Is checks if 'other' is of type Error and has the same code. See https://blog.golang.org/go1.13-errors.
func (Error) WithCausef ¶
WithCausef returns clone of err with the cause added. Use this when you need to provide description of the underlying technical root-cause which may be written in log for debugging purposes. Cause will be shown to the user only when the Message is empty.