Documentation
¶
Overview ¶
Package apperr is the error vocabulary an application's services share with its transports. Services return these errors, wrapped with a reason; each transport maps them to a response in one place (ginhelpers.Status for gin pages and JSON APIs). The package imports nothing, so services can use it without depending on a transport.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound: the thing doesn't exist, or the actor may not know it // exists. ErrNotFound = errors.New("not found") // ErrForbidden: the actor can see the thing but may not do this to it. ErrForbidden = errors.New("forbidden") // ErrNeedsLogin: an anonymous actor would be allowed after logging in. ErrNeedsLogin = errors.New("needs login") // ErrConflict: the change collides with existing state. Wrap it with the // reason: fmt.Errorf("%w: username is taken", apperr.ErrConflict). ErrConflict = errors.New("conflict") )
Functions ¶
Types ¶
type ValidationError ¶
ValidationError rejects an input. Message is shown to the user as is, so it reads as a sentence. Field names the input field, or is empty when the error is about the input as a whole.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Click to show internal directories.
Click to hide internal directories.