Documentation
¶
Overview ¶
Package errors defines stable errors shared by Soro's non-HTTP layers.
Index ¶
- func IsCode(err error, code Code) bool
- type Code
- type Error
- func Conflict(message string) *Error
- func FieldError(field, message string) *Error
- func Forbidden(message string) *Error
- func Internal(cause error) *Error
- func InvalidArgument(message string) *Error
- func InvalidQuery(message string) *Error
- func NotFound(resource string) *Error
- func Unauthorized(message string) *Error
- func Validation(fields map[string][]string) *Error
- func Wrap(code Code, message string, cause error) *Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Code ¶
type Code string
Code identifies a category of framework error without exposing its cause.
type Error ¶
type Error struct {
Code Code `json:"code"`
Message string `json:"message"`
RequestID string `json:"request_id,omitempty"`
Fields map[string][]string `json:"fields,omitempty"`
// contains filtered or unexported fields
}
Error is safe to serialize. Cause is deliberately omitted from JSON.
func FieldError ¶
FieldError adds one normalized message for a field.
func InvalidArgument ¶
func InvalidQuery ¶
func Unauthorized ¶
func Validation ¶
Click to show internal directories.
Click to hide internal directories.