Refactor ReturnCode constants for clarity and consistency

This commit is contained in:
crazywhalecc 2026-02-28 15:36:04 +08:00
parent 4f2ca17bde
commit 174ef3dba7
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680

View File

@ -17,26 +17,28 @@ trait ReturnCode
{
public const int OK = 0;
public const SUCCESS = 0; // alias of OK
public const SUCCESS = 0; // alias
public const int INTERNAL_ERROR = 1; // unsorted or internal error
public const FAILURE = 1; // generic failure
/** @deprecated Use specified error code instead */
public const FAILURE = 1;
// 64-69: reserved for standard errors
public const int USER_ERROR = 64; // wrong usage, bad arguments
public const int USER_ERROR = 2; // wrong usage or user error
public const int VALIDATION_ERROR = 65; // invalid input or config values
public const int ENVIRONMENT_ERROR = 3; // environment not suitable for operation
public const int ENVIRONMENT_ERROR = 69; // required tools/env not available
public const int VALIDATION_ERROR = 4; // validation failed
// 70+: application-specific errors
public const int INTERNAL_ERROR = 70; // internal logic error or unexpected state
public const int FILE_SYSTEM_ERROR = 5; // file system related error
public const int BUILD_ERROR = 72; // build / compile process failed
public const int DOWNLOAD_ERROR = 6; // network related error
public const int PATCH_ERROR = 73; // patching or modifying files failed
public const int BUILD_ERROR = 7; // build process error
public const int FILE_SYSTEM_ERROR = 74; // filesystem / IO error
public const int PATCH_ERROR = 8; // patching process error
public const int DOWNLOAD_ERROR = 75; // network / remote resource error
public const int INTERRUPT_SIGNAL = 130; // process interrupted by user (e.g., Ctrl+C)
// 128+: reserved for standard signals and interrupts
public const int INTERRUPT_SIGNAL = 130; // SIGINT (Ctrl+C)
}