Standard error codes for common Nagare errors
Use these codes for consistent error handling across the codebase. Each error code represents a specific failure scenario that users may encounter.
Error Code Categories:
Git-related errors (GIT_*)
GIT_NOT_INITIALIZED: Working directory is not a git repositoryGIT_UNCOMMITTED_CHANGES: Uncommitted changes prevent releaseGIT_USER_NOT_CONFIGURED: Git user.name or user.email not setGIT_NO_COMMITS: No commits in repositoryGIT_TAG_EXISTS: Tag already exists for versionGIT_REMOTE_ERROR: Error communicating with remote repository
Configuration errors (CONFIG_*)
CONFIG_NOT_FOUND: No nagare.config.ts file foundCONFIG_INVALID: Configuration file has validation errorsCONFIG_MISSING_REQUIRED: Required configuration fields missing
Version errors (VERSION_*)
VERSION_NOT_FOUND: Version pattern not found in fileVERSION_INVALID_FORMAT: Version doesn't match semver formatVERSION_FILE_NOT_FOUND: Specified version file doesn't existVERSION_BUMP_INVALID: Invalid bump type specified
File operation errors (FILE_*)
FILE_NOT_FOUND: Specified file doesn't existFILE_UPDATE_FAILED: Failed to update file contentsFILE_PATTERN_NO_MATCH: Update pattern didn't matchFILE_HANDLER_NOT_FOUND: No handler for file typeFILE_JSON_INVALID: JSON file has syntax errors
GitHub integration errors (GITHUB_*)
GITHUB_CLI_NOT_FOUND: GitHub CLI (gh) not installedGITHUB_AUTH_FAILED: GitHub authentication failedGITHUB_RELEASE_FAILED: Failed to create GitHub release
Template errors (TEMPLATE_*)
TEMPLATE_INVALID: Template syntax errorTEMPLATE_PROCESSING_FAILED: Template rendering failedTEMPLATE_SECURITY_VIOLATION: Template contains unsafe code
Security errors (SECURITY_*)
SECURITY_INVALID_GIT_REF: Invalid git reference formatSECURITY_EMPTY_GIT_REF: Empty git reference providedSECURITY_INVALID_GIT_REF_CHARS: Git reference contains forbidden charactersSECURITY_INVALID_GIT_REF_PATTERN: Git reference has invalid patternSECURITY_GIT_TAG_TOO_LONG: Git tag exceeds maximum lengthSECURITY_INVALID_COMMIT_HASH: Invalid git commit hash formatSECURITY_INVALID_FILE_PATH: Invalid file path formatSECURITY_PATH_TRAVERSAL: Directory traversal attempt detectedSECURITY_PATH_ESCAPE: Path escapes base directorySECURITY_INVALID_VERSION: Invalid version stringSECURITY_INVALID_SEMVER_FORMAT: Version doesn't match semver formatSECURITY_INVALID_CLI_ARG_TYPE: CLI argument has wrong typeSECURITY_SHELL_INJECTION: Shell metacharacters detectedSECURITY_NULL_BYTE_INJECTION: Null byte injection attempt
General errors
DEPENDENCY_NOT_FOUND: Required dependency missingPERMISSION_DENIED: Insufficient permissionsOPERATION_CANCELLED: User cancelled operationUNKNOWN_ERROR: Unexpected error occurred
GIT_NOT_INITIALIZED: string
GIT_UNCOMMITTED_CHANGES: string
GIT_USER_NOT_CONFIGURED: string
GIT_NO_COMMITS: string
GIT_TAG_EXISTS: string
GIT_REMOTE_ERROR: string
CONFIG_NOT_FOUND: string
CONFIG_INVALID: string
CONFIG_MISSING_REQUIRED: string
VERSION_NOT_FOUND: string
VERSION_INVALID_FORMAT: string
VERSION_FILE_NOT_FOUND: string
VERSION_BUMP_INVALID: string
FILE_NOT_FOUND: string
FILE_UPDATE_FAILED: string
FILE_PATTERN_NO_MATCH: string
FILE_HANDLER_NOT_FOUND: string
FILE_JSON_INVALID: string
GITHUB_CLI_NOT_FOUND: string
GITHUB_AUTH_FAILED: string
GITHUB_RELEASE_FAILED: string
TEMPLATE_INVALID: string
TEMPLATE_PROCESSING_FAILED: string
TEMPLATE_SECURITY_VIOLATION: string
SECURITY_INVALID_GIT_REF: string
SECURITY_EMPTY_GIT_REF: string
SECURITY_INVALID_GIT_REF_CHARS: string
SECURITY_INVALID_GIT_REF_PATTERN: string
SECURITY_GIT_TAG_TOO_LONG: string
SECURITY_INVALID_COMMIT_HASH: string
SECURITY_INVALID_FILE_PATH: string
SECURITY_PATH_TRAVERSAL: string
SECURITY_PATH_ESCAPE: string
SECURITY_INVALID_VERSION: string
SECURITY_INVALID_SEMVER_FORMAT: string
SECURITY_INVALID_CLI_ARG_TYPE: string
SECURITY_SHELL_INJECTION: string
SECURITY_NULL_BYTE_INJECTION: string
DEPENDENCY_NOT_FOUND: string
PERMISSION_DENIED: string
OPERATION_CANCELLED: string
RELEASE_FAILED: string
UNKNOWN_ERROR: string