Documentation ¶
Overview ¶
Package errors provides a robust errors type which implements the built-in error interface. It includes the following:
* Code, an int field for integer error codes such as HTTP status
* Meta, a []string field for high-level errors
* Fields, a map[string]string field for named errors
It supports both JSON and XML marshaling.
Index ¶
- type Error
- func (er *Error) Add(msg string, args ...interface{})
- func (er *Error) AddMeta(msg string, args ...interface{})
- func (er Error) Error() string
- func (er Error) Exists() bool
- func (er Error) InField(field string) bool
- func (er Error) IsEmpty() bool
- func (er Error) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (er *Error) Set(field, msg string, args ...interface{})
- func (er *Error) SetField(field, msg string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct { Code int `json:"code,omitempty"` Meta []string `json:"meta"` Fields map[string]string `json:"fields"` }
Error is an error structure with meta and field-specific errors
func (Error) MarshalXML ¶
MarshalXML implements a custom marshaler because Errors has a map
Click to show internal directories.
Click to hide internal directories.