Documentation ¶
Overview ¶
Package errors provides the error interface used by Blacksmith and the adapters. It is also the recommended way to handle errors in Blacksmith applications.
To avoid import cycles, this package should not import any other Blacksmith packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct { // StatusCode is the HTTP status code returned by the caller. StatusCode int `json:"statusCode,omitempty"` // Message is the error message. Message string `json:"message,omitempty"` // Validations is a list of validation errors. Validations []Validation `json:"validations,omitempty"` // Meta includes meta details about the error. It is only used when dealing // with HTTP errors to provide a consistent HTTP response across adapters. Meta *Meta `json:"meta,omitempty"` }
Error is used across every Blacksmith packages to normalize error handling. Error implements the standard error interface.
type Event ¶
type Event struct { // ID is the generated ID of the event. ID string `json:"id"` }
Event is the representation of an event inside error.
type Meta ¶
type Meta struct { // Event contains the fields related to an event when dealing with HTTP errors. Event *Event `json:"event,omitempty"` }
Meta is used when dealing with HTTP errors to provide a consistent HTTP response across adapters.
type Validation ¶
type Validation struct { // Message is the error message. Message string `json:"message"` // Path gives more details about where the error happened. Path []string `json:"path"` }
Validation gives additional info about the parent error. An error can have multiple error validations.
Click to show internal directories.
Click to hide internal directories.