Documentation ¶
Index ¶
- func CondFieldEq(theField string) errors.MapCond
- func CondReasonEq(theReason string) errors.MapCond
- func CondValidation() errors.MapCond
- func DefaultMapping() errors.MapFunc
- func GetValidationError(err error) error
- func ToMapFunc(f func(context.Context, ValidationError) (error, bool)) errors.MapFunc
- func UnaryServerInterceptor() grpc.UnaryServerInterceptor
- type RequestValidationError
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CondFieldEq ¶
CondFieldEq function returns a condition function that checks if the field matches the validation error field.
func CondReasonEq ¶
CondReasonEq function returns a condition function that checks if the reason matches the validation error reason.
func CondValidation ¶
CondValidation function returns a condition function that matches standard Validation error and ensures that the error contains a field and a reason.
func DefaultMapping ¶
DefaultMapping the default behavior for validation error mapping.
func GetValidationError ¶
GetValidationError function returns a validation error from an error.
func ToMapFunc ¶
ToMapFunc function converts mapping function for *validationerrors.Error to a conventional MapFunc from atlas-app-toolkit/errors package.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor() grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a new unary server interceptor that validates incoming messages.
Invalid messages will be rejected with `InvalidArgument` before reaching any userspace handlers.
Types ¶
type RequestValidationError ¶ added in v0.14.0
type RequestValidationError interface { Field() string Reason() string Key() bool Cause() error ErrorName() string }
RequestValidationError represent a validation error
type ValidationError ¶
type ValidationError struct {
// contains filtered or unexported fields
}
ValidationError represents the validation error that contains which field failed and the reasoning behind it.
func (ValidationError) Cause ¶
func (e ValidationError) Cause() error
Cause function returns cause value.
func (ValidationError) Error ¶
func (e ValidationError) Error() string
Error satisfies the builtin error interface
func (ValidationError) ErrorName ¶ added in v0.14.0
func (e ValidationError) ErrorName() string
ErrorName returns error name.
func (ValidationError) Field ¶
func (e ValidationError) Field() string
Field function returns field value.
func (ValidationError) Reason ¶
func (e ValidationError) Reason() string
Reason function returns reason value.