Documentation ¶
Index ¶
- type Code
- type Error
- func (e Error) Error() string
- func (e *Error) Response() *router.Response
- func (e *Error) SetCause(c error) *Error
- func (e *Error) SetCode(c Code) *Error
- func (e *Error) SetDetail(d map[string]interface{}) *Error
- func (e *Error) SetFieldErrors(errs validate.Errors) *Error
- func (e Error) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct { Status int `json:"-"` Code Code `json:"code,omitempty"` Message string `json:"message,omitempty"` Cause error `json:"-"` Detail map[string]interface{} `json:"detail,omitempty"` }
func Wrap ¶ added in v1.2.0
Conditionally wrap the parameter error in a REST Error. If the parameter error is already a REST Error, it is simply returned. Otherwise, a new REST Error is created with the provided status, message and the parameter as the cause.
This is intended to be used in cases where the caller receives an error that may or may not be a REST Error and needs to report the result to the REST client. If the error is already a REST Error, that error should be reported, and if not, the underlying error should be wrapped in a more generic error.
func (*Error) SetFieldErrors ¶
Click to show internal directories.
Click to hide internal directories.