Documentation ¶
Overview ¶
Package errs provides types and support related to web error functionality.
Index ¶
- Variables
- func Check(val any) error
- func IsFieldErrors(err error) bool
- func New(code errs.ErrCode, err error) *errs.Error
- func NewFieldsError(field string, err error) error
- func NewResponse(code errs.ErrCode, err error) middleware.Response
- func NewResponsef(code errs.ErrCode, format string, v ...any) middleware.Response
- func Newf(code errs.ErrCode, format string, v ...any) *errs.Error
- type FieldError
- type FieldErrors
Constants ¶
This section is empty.
Variables ¶
var ( OK = errs.OK NoContent = errs.OK Canceled = errs.Canceled Unknown = errs.Unknown InvalidArgument = errs.InvalidArgument DeadlineExceeded = errs.DeadlineExceeded NotFound = errs.NotFound AlreadyExists = errs.AlreadyExists PermissionDenied = errs.PermissionDenied ResourceExhausted = errs.ResourceExhausted FailedPrecondition = errs.FailedPrecondition Aborted = errs.Aborted OutOfRange = errs.OutOfRange Unimplemented = errs.Unimplemented Internal = errs.Internal DataLoss = errs.DataLoss Unauthenticated = errs.Unauthenticated )
This set of variables exist so I can move APP layer code from the service project over without the need to refactor.
Functions ¶
func IsFieldErrors ¶
IsFieldErrors checks if an error of type FieldErrors exists.
func NewFieldsError ¶
NewFieldsError creates an fields error.
func NewResponse ¶
func NewResponse(code errs.ErrCode, err error) middleware.Response
NewResponse constructs an encore middleware response with a Go error.
func NewResponsef ¶
NewResponsef constructs an encore middleware response with a message.
Types ¶
type FieldError ¶
FieldError is used to indicate an error with a specific request field.
type FieldErrors ¶
type FieldErrors []FieldError
FieldErrors represents a collection of field errors.
func GetFieldErrors ¶
func GetFieldErrors(err error) FieldErrors
GetFieldErrors returns a copy of the FieldErrors pointer.
func (FieldErrors) Error ¶
func (fe FieldErrors) Error() string
Error implements the error interface.
func (FieldErrors) Fields ¶
func (fe FieldErrors) Fields() map[string]string
Fields returns the fields that failed validation