Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Error ¶
type Error struct { Err error `json:"-"` Type Type `json:"-"` Message string `json:"message"` Timestamp time.Time `json:"-"` Reason Reason `json:"reason"` Domain Domain `json:"domain"` Metadata map[string]string `json:"metadata"` }
func NewLocal ¶ added in v0.0.4
func NewLocal(cause error, local LocalError) Error
NewLocal is a constructor to create a minimally viable Error instance given an a root cause and implementation of LocalError.
func (Error) WithMessage ¶
func (Error) WithMetaMap ¶ added in v0.0.4
WithMetaMap is a fluent style method to set the Metadata map on the Error instance.
func (Error) WithMetaPair ¶ added in v0.0.4
WithMetaPair is a fluent style convenience method to append to the Metadata map. If the Metadata map doesn't exist, it sets a new one, otherwise appends to the existing map.
func (Error) WithMetaPairs ¶ added in v0.0.4
WithMetaPairs is a fluent style convenience method to define the Metadata map as a series of key-value pairs. Destructive, sets the Metadata field with a new Map before iterating over the parameters. This will iterate over the variadic in pairs, and take the even index as the key, and the odd index as the value, as such, an odd number of values passed will see the last value ignored.
type LocalError ¶ added in v0.0.4
LocalError defines the contract that allows implementing systems to define their own Reason codes