--- source_files: - DataPRO/DbAPI/Errors/ErrorCodes.cs generated_at: "2026-04-17T16:29:44.608866+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "cd3e42ca1eeef316" --- # Errors ### Purpose This module defines a centralized registry of error codes used throughout the DbAPI system. It provides a standardized set of error constants (both system-level and application-specific) and a utility method for converting error codes to human-readable strings, enabling consistent error handling and reporting across the codebase. ### Public Interface **Class: `ErrorCodes` (abstract)** - `public const ulong ERROR_SUCCESS = 0x0` - Indicates successful operation completion. - `public const ulong ERROR_INVALID_FUNCTION = 0x1` - Invalid function was called. - `public const ulong ERROR_FILE_NOT_FOUND = 0x2` - Specified file could not be located. - `public const ulong ERROR_PATH_NOT_FOUND = 0x3` - Specified path could not be located. - `public const ulong ERROR_ACCESS_DENIED = 0x5` - Access was denied to the requested resource. - `public const ulong ERROR_NOT_SUPPORTED = 0x32` - The requested operation is not supported. - `public const ulong INVALID_SESSIONID = 0x200` - Session identifier is invalid or expired. - `public const ulong ERROR_UNKNOWN = 0x201` - An unknown/unexpected error occurred. - `public const ulong ERROR_NOUSER = 0x202` - No user is associated with the operation. - `public const ulong ERROR_LOGINFAILED = 0x203` - Login attempt failed. - `public const ulong ERROR_MISSING_PARAMETER = 0x204` - A required parameter was not provided. - `public static string ResultToString(ulong hr)` - Converts an error code to its string representation. Returns the symbolic name for known codes (e.g., "SUCCESS", "ACCESS_DENIED") or the hexadecimal representation for unknown codes. ### Invariants - All error codes are defined as `ulong` (unsigned 64-bit integers). - `ERROR_SUCCESS` (0x0) is the only success code; all non-zero values indicate errors. - System-level errors (0x0-0x32 range) mirror Windows error codes. - Application-specific errors start at 0x200. - The class is `abstract`, preventing instantiation (intended to be used only for its static members). ### Dependencies - **Depends on:** None (standalone module with no imports). - **Depended on by:** Unclear from source alone; likely consumed by all DbAPI components for error handling and reporting. ### Gotchas - `ERROR_MISSING_PARAMETER` is defined as a constant but is **not handled** in the `ResultToString` switch statement—it will return the hex string "204" instead of a symbolic name. - The class is `abstract` but contains no virtual or abstract members; it functions as a static utility class pattern but could have been declared `static` instead. - Error code values 0x4, 0x6-0x31 are undefined/skipped in the constants list despite being in the system error range. ---