You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.6 KiB
Go

// Package errors provides domain-specific error types for the KnowFoolery application.
package errors
// ErrorCode represents a unique error code for domain errors.
type ErrorCode string
// Error codes for the KnowFoolery application.
const (
// General errors
CodeNotFound ErrorCode = "NOT_FOUND"
CodeInvalidInput ErrorCode = "INVALID_INPUT"
CodeUnauthorized ErrorCode = "UNAUTHORIZED"
CodeForbidden ErrorCode = "FORBIDDEN"
CodeConflict ErrorCode = "CONFLICT"
CodeInternal ErrorCode = "INTERNAL"
// Game session errors
CodeSessionExpired ErrorCode = "SESSION_EXPIRED"
CodeGameInProgress ErrorCode = "GAME_IN_PROGRESS"
CodeMaxAttemptsReached ErrorCode = "MAX_ATTEMPTS_REACHED"
CodeSessionNotActive ErrorCode = "SESSION_NOT_ACTIVE"
// Question errors
CodeQuestionNotFound ErrorCode = "QUESTION_NOT_FOUND"
CodeNoQuestionsAvailable ErrorCode = "NO_QUESTIONS_AVAILABLE"
// User errors
CodeUserNotFound ErrorCode = "USER_NOT_FOUND"
CodeUserAlreadyExists ErrorCode = "USER_ALREADY_EXISTS"
CodeEmailNotVerified ErrorCode = "EMAIL_NOT_VERIFIED"
// Validation errors
CodeValidationFailed ErrorCode = "VALIDATION_FAILED"
CodeInvalidPlayerName ErrorCode = "INVALID_PLAYER_NAME"
CodeInvalidAnswer ErrorCode = "INVALID_ANSWER"
// Authentication errors
CodeInvalidToken ErrorCode = "INVALID_TOKEN"
CodeTokenExpired ErrorCode = "TOKEN_EXPIRED"
CodeMFARequired ErrorCode = "MFA_REQUIRED"
// Rate limiting errors
CodeRateLimitExceeded ErrorCode = "RATE_LIMIT_EXCEEDED"
)
// String returns the string representation of the error code.
func (c ErrorCode) String() string {
return string(c)
}