Documentation ¶
Index ¶
- func CreateInvalidError(errorCodeSuffix string, message string, args ...any) error
- func HasErrorCode(err error, c ErrorCode) bool
- func IsError(e error) bool
- func NewHeaderError(message string, args ...any) error
- func NewInternalError(message string, args ...any) error
- func NewInvalidActionError(message string) error
- func NewInvalidDataError(message string, args ...any) error
- func NewInvalidJSONError(resultErrors []gojsonschema.ResultError) error
- func NewMalformedError() error
- func NewNotFoundError(resource string, id string) error
- func NewParamError(message string, args ...any) error
- func NewUnauthenticatedError(message string, args ...any) error
- func NewUnauthorizedError() error
- func NewUnavailableError() error
- func ProcessParamError(err error) error
- type Error
- type ErrorCode
- type SchemaValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateInvalidError ¶
Dynamic error generation functions
func HasErrorCode ¶
func NewHeaderError ¶
func NewInternalError ¶
func NewInvalidActionError ¶
func NewInvalidDataError ¶
func NewInvalidJSONError ¶
func NewInvalidJSONError(resultErrors []gojsonschema.ResultError) error
func NewMalformedError ¶
func NewMalformedError() error
func NewNotFoundError ¶
func NewParamError ¶
func NewUnauthenticatedError ¶
func NewUnauthorizedError ¶
func NewUnauthorizedError() error
func NewUnavailableError ¶
func NewUnavailableError() error
func ProcessParamError ¶
Types ¶
type Error ¶
type Error struct { HttpStatusCode int `json:"-"` ErrorCode ErrorCode `json:"code"` Message string `json:"message"` SchemaValidationErrors []SchemaValidationError `json:"validationErrors,omitempty"` // The following are intentionally not included in any public response LogLevel logger.Level LogMessage string }
type ErrorCode ¶
type ErrorCode string
const ( InvalidAction ErrorCode = "invalid_action" InvalidJSON ErrorCode = "invalid_json" InvalidData ErrorCode = "invalid_data" InvalidHeader ErrorCode = "invalid_header" InvalidParam ErrorCode = "invalid_parameter" NotFound ErrorCode = "resource_not_found" Unauthenticated ErrorCode = "unauthenticated" Malformed ErrorCode = "malformed" Internal ErrorCode = "internal_error" )
func CreateErrorCode ¶
type SchemaValidationError ¶
type SchemaValidationError struct { DataPath string `json:"dataPath"` Message string `json:"message"` }
func (SchemaValidationError) GetField ¶
func (sve SchemaValidationError) GetField() string
Click to show internal directories.
Click to hide internal directories.