Documentation
¶
Index ¶
- Variables
- func AugmentLogFromCtx(ctx context.Context, l logrus.FieldLogger) logrus.FieldLogger
- func CtxWithLogField(ctx context.Context, key string, value string) context.Context
- func CtxWithTraceID(ctx context.Context, id string) context.Context
- func IsConflictError(err error) bool
- func IsNotFoundError(err error) bool
- func IsValidationError(err error) bool
- func NewConflictError(message string) error
- func NewValidationError(message string) error
- func TraceIDFromCtx(ctx context.Context) string
- type ConflictError
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound represents all kind of problems resulting from not finding something. ErrNotFound = errors.New("not found") )
Sentinel errors.
Functions ¶
func AugmentLogFromCtx ¶
func AugmentLogFromCtx(ctx context.Context, l logrus.FieldLogger) logrus.FieldLogger
AugmentLogFromCtx augments logger with data from context.
func CtxWithLogField ¶
CtxWithLogField adds extra log information to context.
func CtxWithTraceID ¶
CtxWithTraceID returns new context with trace id..
func IsConflictError ¶
IsConflictError returns true if err has ConflictError in its chain.
func IsNotFoundError ¶
IsNotFoundError returns true if err has NotFoundError in its chain.
func IsValidationError ¶
IsValidationError returns true if err has ValidationError in its chain.
func NewConflictError ¶
NewConflictError creates new ConflictError instance.
func NewValidationError ¶
NewValidationError creates new ValidationError instance.
func TraceIDFromCtx ¶
TraceIDFromCtx returns trace id from context. If id is not present in context, returns emoty string.
Types ¶
type ConflictError ¶
type ConflictError struct {
Err error
}
ConflictError represents all kind of problems resulting from conflicting state. For example - something was supposed to be created but it already exists.
type ValidationError ¶
type ValidationError struct {
Err error
}
ValidationError represents all kind of invalid data errors.
func (ValidationError) Error ¶
func (e ValidationError) Error() string
Error fullfills error interface.