Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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"} ErrForbidden = Error{Code: "forbidden", Message: "You are not authorised for the requested action"} ErrInternal = Error{Code: "internal_error", Message: "Some unexpected error occurred"} ErrUnsupported = Error{Code: "unsupported", Message: "Requested feature is not supported"} )
Common timer domain errors. Use `ErrX.WithCausef()` to clone and add context.
Functions ¶
func Errorf ¶
Errorf returns a formatted error similar to `fmt.Errorf` but uses the Error type defined in this package. returned value is equivalent to ErrInternal (i.e., errors.Is(retVal, ErrInternal) = true).
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 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.