errors

package
v0.9.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Domain errors
	ErrCodeGoalNotFound       = "GOAL_NOT_FOUND"
	ErrCodeChallengeNotFound  = "CHALLENGE_NOT_FOUND"
	ErrCodeGoalAlreadyClaimed = "GOAL_ALREADY_CLAIMED"
	ErrCodeGoalNotCompleted   = "GOAL_NOT_COMPLETED"
	ErrCodeInvalidStatus      = "INVALID_STATUS"

	// Database errors
	ErrCodeDatabaseError     = "DATABASE_ERROR"
	ErrCodeTransactionFailed = "TRANSACTION_FAILED"

	// Config errors
	ErrCodeConfigInvalid  = "CONFIG_INVALID"
	ErrCodeConfigNotFound = "CONFIG_NOT_FOUND"

	// AGS integration errors
	ErrCodeRewardGrantFailed = "REWARD_GRANT_FAILED"
	ErrCodeAuthFailed        = "AUTH_FAILED"

	// Validation errors
	ErrCodeValidationFailed = "VALIDATION_FAILED"
	ErrCodeInvalidInput     = "INVALID_INPUT"
)

Error codes for the challenge service.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChallengeError

type ChallengeError struct {
	Code    string
	Message string
	Err     error
}

ChallengeError represents an error in the challenge service.

func ErrChallengeNotFound

func ErrChallengeNotFound(challengeID string) *ChallengeError

ErrChallengeNotFound returns an error when a challenge is not found.

func ErrConfigInvalid

func ErrConfigInvalid(reason string) *ChallengeError

ErrConfigInvalid returns an error for invalid configuration.

func ErrDatabaseError

func ErrDatabaseError(operation string, err error) *ChallengeError

ErrDatabaseError wraps database errors.

func ErrGoalAlreadyClaimed

func ErrGoalAlreadyClaimed(goalID string) *ChallengeError

ErrGoalAlreadyClaimed returns an error when attempting to claim an already claimed goal.

func ErrGoalNotCompleted

func ErrGoalNotCompleted(goalID string) *ChallengeError

ErrGoalNotCompleted returns an error when attempting to claim an incomplete goal.

func ErrGoalNotFound

func ErrGoalNotFound(goalID string) *ChallengeError

ErrGoalNotFound returns an error when a goal is not found.

func ErrRewardGrantFailed

func ErrRewardGrantFailed(rewardType, rewardID string, err error) *ChallengeError

ErrRewardGrantFailed returns an error when reward grant fails.

func ErrValidationFailed

func ErrValidationFailed(field, reason string) *ChallengeError

ErrValidationFailed returns a validation error.

func NewChallengeError

func NewChallengeError(code, message string, err error) *ChallengeError

NewChallengeError creates a new ChallengeError.

func (*ChallengeError) Error

func (e *ChallengeError) Error() string

func (*ChallengeError) Unwrap

func (e *ChallengeError) Unwrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL