Documentation ¶
Index ¶
Constants ¶
View Source
const UnknownCode = "UNKNOWN"
UnknownCode is used as the code when a real code could not be found
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataError ¶
type DataError interface { // Error satisfies the error interface Error() string // Inner returns the originating error Inner() error // Code returns a specific error code, this is meant to be a machine friendly string Code() string // Wrap will set err as the cause of the error and returns itself Wrap(err DataError) DataError // GetCause will return the cause of this error GetCause() DataError }
DataError is a class of error that provides access to an error code as well as the originating error
func FromHTTPProblem ¶
FromHTTPProblem will create a DataError from an HTTPProblem
type HTTPProblem ¶
type HTTPProblem struct { Type string `json:"type,omitempty"` Title string `json:"title,omitempty"` Status int `json:"status,omitempty"` Detail string `json:"detail,omitempty"` Instance string `json:"instance,omitempty"` Code string `json:"code,omitempty"` }
HTTPProblem should be used as the response in case of an error during an HTTP request. It implements the https://datatracker.ietf.org/doc/rfc7807 spec with an addition code field which is meant to be machine readable and give clients enough information to handle the error appropriately.
func (HTTPProblem) Error ¶
func (h HTTPProblem) Error() string
Click to show internal directories.
Click to hide internal directories.