Documentation ¶
Index ¶
- Constants
- func GetErrorDetails(err error) string
- func GetErrorType(err error) string
- func LogErrorFromCtx(ctx context.Context, err error)
- func LoggerFromContext(ctx context.Context) (*zap.SugaredLogger, bool)
- func NewError(message string, err error, typeError string, meta map[string]string, ...) error
- func NewLogger() (*zap.Logger, error)
- func NewValidationError(validationError error, uniTranslator *ut.UniversalTranslator) error
- func WithMeta(err error, key, value string) error
- func WithOperation(err error, operation string) error
- type CustomError
- type LoggerType
Constants ¶
View Source
const ( NotFoundError = "NotFoundError" InternalError = "InternalError" IllegalParamError = "IllegalParamError" ParseError = "ParseError" BusinessError = "BusinessError" ForbiddenError = "ForbiddenError" )
View Source
const LoggerFlag = LoggerType("api-logger-context")
Variables ¶
This section is empty.
Functions ¶
func GetErrorDetails ¶
func GetErrorType ¶
func LogErrorFromCtx ¶
func LoggerFromContext ¶
func LoggerFromContext(ctx context.Context) (*zap.SugaredLogger, bool)
func NewValidationError ¶
func NewValidationError(validationError error, uniTranslator *ut.UniversalTranslator) error
func WithOperation ¶
Types ¶
type CustomError ¶
type CustomError struct { ID uuid.UUID `json:"id"` Message string `json:"message"` Detail string `json:"detail"` Operations []string `json:"-"` Type string `json:"type"` Timestamp string `json:"timestamp"` Meta map[string]string `json:"-"` }
func Unwrap ¶
func Unwrap(err error) CustomError
func (CustomError) Error ¶
func (customError CustomError) Error() string
type LoggerType ¶
type LoggerType string
Click to show internal directories.
Click to hide internal directories.