Files
uzdb/internal/models/errors.go
loveuer 9874561410 refactor: Flatten directory structure
Move project files from uzdb/ subdirectory to root directory for cleaner project structure.

Changes:
- Move frontend/ to root
- Move internal/ to root
- Move build/ to root
- Move all config files (go.mod, wails.json, etc.) to root
- Remove redundant uzdb/ subdirectory nesting

Project structure is now:
├── frontend/        # React application
├── internal/        # Go backend
├── build/           # Wails build assets
├── doc/             # Design documentation
├── main.go          # Entry point
└── ...

🤖 Generated with Qoder
2026-04-04 07:14:00 -07:00

75 lines
2.0 KiB
Go

package models
import "errors"
// Application errors
var (
// ErrNotFound resource not found
ErrNotFound = errors.New("resource not found")
// ErrAlreadyExists resource already exists
ErrAlreadyExists = errors.New("resource already exists")
// ErrValidationFailed validation failed
ErrValidationFailed = errors.New("validation failed")
// ErrUnauthorized unauthorized access
ErrUnauthorized = errors.New("unauthorized access")
// ErrForbidden forbidden access
ErrForbidden = errors.New("forbidden access")
// ErrInternalServer internal server error
ErrInternalServer = errors.New("internal server error")
// ErrConnectionFailed connection failed
ErrConnectionFailed = errors.New("connection failed")
// ErrQueryFailed query execution failed
ErrQueryFailed = errors.New("query execution failed")
// ErrEncryptionFailed encryption/decryption failed
ErrEncryptionFailed = errors.New("encryption/decryption failed")
// ErrInvalidConfig invalid configuration
ErrInvalidConfig = errors.New("invalid configuration")
// ErrDatabaseLocked database is locked
ErrDatabaseLocked = errors.New("database is locked")
// ErrTimeout operation timeout
ErrTimeout = errors.New("operation timeout")
)
// ErrorCode represents error codes for API responses
type ErrorCode string
const (
// CodeSuccess successful operation
CodeSuccess ErrorCode = "SUCCESS"
// CodeNotFound resource not found
CodeNotFound ErrorCode = "NOT_FOUND"
// CodeValidation validation error
CodeValidation ErrorCode = "VALIDATION_ERROR"
// CodeUnauthorized unauthorized
CodeUnauthorized ErrorCode = "UNAUTHORIZED"
// CodeForbidden forbidden
CodeForbidden ErrorCode = "FORBIDDEN"
// CodeInternal internal error
CodeInternal ErrorCode = "INTERNAL_ERROR"
// CodeConnection connection error
CodeConnection ErrorCode = "CONNECTION_ERROR"
// CodeQuery query error
CodeQuery ErrorCode = "QUERY_ERROR"
// CodeEncryption encryption error
CodeEncryption ErrorCode = "ENCRYPTION_ERROR"
)