Versions in this module Expand all Collapse all v1 v1.8.0 Jun 29, 2025 v1.7.0 Jun 28, 2025 v1.6.0 Jun 26, 2025 v1.5.0 Jun 24, 2025 Changes in this version + func DetectErrorFromContext(ctx context.Context) error + func DetectErrorType(err error) string + func FormatErrorWithSource(err error, source string) string + func IsContextError(err error) bool + func IsRetryError(err error) bool + func IsTransientError(err error) bool + type ContextError = infra.ContextError + func NewContextError(message string, cause error) *ContextError + type RetryError = infra.RetryError + func NewRetryError(message string, cause error, attempts int, maxAttempts int) *RetryError v1.4.0 Jun 23, 2025 Changes in this version + var ErrCanceled = core.NewBaseError(CanceledCode, "operation canceled", nil) + func IsAuthenticationError(err error) bool + func IsAuthorizationError(err error) bool + func IsBusinessRuleError(err error) bool + func IsConfigurationError(err error) bool + func IsDatabaseError(err error) bool + func IsDomainError(err error) bool + func IsExternalServiceError(err error) bool + func IsInfrastructureError(err error) bool + func IsNetworkError(err error) bool + func WrapWithDetails(err error, code ErrorCode, message string, details map[string]interface{}) error + type AuthenticationError = app.AuthenticationError + func NewAuthenticationError(message string, username string, cause error) *AuthenticationError + type AuthorizationError = app.AuthorizationError + func NewAuthorizationError(message string, username string, resource string, action string, cause error) *AuthorizationError + type BaseError = core.BaseError + type BusinessRuleError = domain.BusinessRuleError + func NewBusinessRuleError(message string, rule string, cause error) *BusinessRuleError + type ConfigurationError = app.ConfigurationError + func NewConfigurationError(message string, configKey string, configValue string, cause error) *ConfigurationError + type DatabaseError = infra.DatabaseError + func NewDatabaseError(message string, operation string, table string, cause error) *DatabaseError + type ExternalServiceError = infra.ExternalServiceError + func NewExternalServiceError(message string, serviceName string, endpoint string, cause error) *ExternalServiceError + type InfrastructureError = infra.InfrastructureError + func NewInfrastructureError(code ErrorCode, message string, cause error) *InfrastructureError + type NetworkError = infra.NetworkError + func NewNetworkError(message string, host string, port string, cause error) *NetworkError v1.3.0 Jun 22, 2025 v1.2.0 Jun 21, 2025 v1.1.0 Jun 20, 2025 v1.0.0 Jun 19, 2025 Changes in this version + var ErrAlreadyExists = errors.New("resource already exists") + var ErrCancelled = errors.New("operation cancelled") + var ErrConflict = errors.New("conflict with current state") + var ErrForbidden = errors.New("forbidden") + var ErrInternal = errors.New("internal error") + var ErrInvalidInput = errors.New("invalid input") + var ErrNotFound = errors.New("resource not found") + var ErrTimeout = errors.New("operation timed out") + var ErrUnauthorized = errors.New("unauthorized") + func AlreadyExists(format string, args ...interface{}) error + func As(err error, target interface{}) bool + func BusinessRuleViolation(format string, args ...interface{}) error + func Canceled(format string, args ...interface{}) error + func Concurrency(format string, args ...interface{}) error + func Configuration(format string, args ...interface{}) error + func DataCorruption(format string, args ...interface{}) error + func DatabaseOperation(err error, format string, args ...interface{}) error + func ExternalService(err error, service string, format string, args ...interface{}) error + func Forbidden(format string, args ...interface{}) error + func GetHTTPStatus(err error) int + func GetHTTPStatusFromError(err error) int + func Internal(err error, format string, args ...interface{}) error + func InvalidInput(format string, args ...interface{}) error + func Is(err error, target error) bool + func IsApplicationError(err error) bool + func IsCancelled(err error) bool + func IsConflict(err error) bool + func IsForbidden(err error) bool + func IsInternal(err error) bool + func IsInvalidInput(err error) bool + func IsNotFound(err error) bool + func IsNotFoundError(err error) bool + func IsRepositoryError(err error) bool + func IsTimeout(err error) bool + func IsUnauthorized(err error) bool + func IsValidationError(err error) bool + func Network(err error, format string, args ...interface{}) error + func New(op, code, message string, original error) error + func NotFound(format string, args ...interface{}) error + func ResourceExhausted(format string, args ...interface{}) error + func Timeout(format string, args ...interface{}) error + func ToJSON(err error) string + func Unauthorized(format string, args ...interface{}) error + func Unwrap(err error) error + func Validation(format string, args ...interface{}) error + func WithDetails(err error, details map[string]interface{}) error + func Wrap(err error, op, message string) error + func WrapWithOperation(err error, operation string, format string, args ...interface{}) error + type AppError struct + Code string + Err error + Message string + Type T + func NewAppError[T ~string](err error, message, code string, errorType T) *AppError[T] + func (e *AppError[T]) Error() string + func (e *AppError[T]) ErrorType() T + func (e *AppError[T]) Unwrap() error + type ApplicationError struct + Code string + Err error + Message string + func NewApplicationError(err error, message, code string) *ApplicationError + func (e *ApplicationError) Error() string + func (e *ApplicationError) Unwrap() error + type ApplicationErrorInterface interface + IsApplicationError func() bool + type ContextualError struct + Context ErrorContext + Original error + func (e *ContextualError) Code() ErrorCode + func (e *ContextualError) Error() string + func (e *ContextualError) HTTPStatus() int + func (e *ContextualError) MarshalJSON() ([]byte, error) + func (e *ContextualError) Unwrap() error + type DomainError = AppError[DomainErrorType] + func NewDomainError(err error, message, code string) *DomainError + type DomainErrorType string + const DomainErrorGeneral + type Error struct + Code string + Message string + Op string + Original error + Param string + func (e *Error) Error() string + func (e *Error) Is(target error) bool + func (e *Error) Unwrap() error + type ErrorCode string + const AlreadyExistsCode + const BusinessRuleViolationCode + const CanceledCode + const ConcurrencyErrorCode + const ConfigurationErrorCode + const DataCorruptionCode + const DatabaseErrorCode + const ExternalServiceErrorCode + const ForbiddenCode + const InternalErrorCode + const InvalidInputCode + const NetworkErrorCode + const NotFoundCode + const ResourceExhaustedCode + const TimeoutCode + const UnauthorizedCode + const ValidationErrorCode + func GetCode(err error) ErrorCode + type ErrorContext struct + Code ErrorCode + Details map[string]interface{} + HTTPStatus int + Line int + Operation string + Source string + type ErrorWithCode interface + Code func() string + type ErrorWithHTTPStatus interface + HTTPStatus func() int + type GenericError struct + Category T + Code string + Err error + Message string + func NewGenericError[T any](err error, message, code string, category T) *GenericError[T] + func (e *GenericError[T]) Error() string + func (e *GenericError[T]) Unwrap() error + type NotFoundError struct + ID string + ResourceType string + func NewNotFoundError(resourceType, id string) *NotFoundError + func (e *NotFoundError) Error() string + func (e *NotFoundError) Is(target error) bool + type NotFoundErrorInterface interface + IsNotFoundError func() bool + type RepositoryError struct + Code string + Err error + Message string + func NewRepositoryError(err error, message, code string) *RepositoryError + func (e *RepositoryError) Error() string + func (e *RepositoryError) Unwrap() error + type RepositoryErrorInterface interface + IsRepositoryError func() bool + type ValidationError struct + Field string + Msg string + func NewFieldValidationError(msg, field string) *ValidationError + func NewValidationError(msg string) *ValidationError + func (e *ValidationError) Error() string + type ValidationErrorInterface interface + IsValidationError func() bool + type ValidationErrors struct + Errors []*ValidationError + func NewValidationErrors(errors ...*ValidationError) *ValidationErrors + func (e *ValidationErrors) AddError(err *ValidationError) + func (e *ValidationErrors) Error() string + func (e *ValidationErrors) HasErrors() bool