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 // Msg returns the originating message Msg() 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 // IsTransient will return if the error is considered transient IsTransient() bool // GetFields returns the extra fields for giving better error descriptions GetFields() map[string]interface{} // GetField returns the data of a field from the fields member of the DataError if one exists GetField(name string) interface{} // AddFields will add fields to the given DataErrors fields AddFields(map[string]interface{}) // AddField will add the key and value pair to the data errors fields AddField(key string, value interface{}) // String implements the string interface for %s in fmt calls String() string }
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
func NewDataError ¶
NewDataError will create a DataError from the information provided
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"` IsTransient bool `json:"is_transient"` }
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 these additional fields:
code: meant to be machine readable and give clients enough information to handle the error appropriately is_transient: meant to inform clients that the problem is considered transient and could be retried
swagger:model HTTPProblem
func (HTTPProblem) Error ¶
func (h HTTPProblem) Error() string
type HTTPProblemMetadata ¶
type HTTPProblemMetadata struct { HTTPProblem Metadata interface{} `json:"metadata"` }
func (HTTPProblemMetadata) Error ¶
func (h HTTPProblemMetadata) Error() string
Click to show internal directories.
Click to hide internal directories.