Luminova Framework

PHP Luminova: Exceptions and Custom Error Codes

Last updated: 2024-08-29 02:30:39

Explore Comprehensive Documentation on Luminova Exception and Error Handling: Detailed Error Types and Codes for Enhanced Code Quality.

This documentation provides a complete reference for error codes with it's usage descriptions. The ErrorCodes trait in the Luminova framework defines a set of constants that represent various error codes. These codes encompass a wide range of PHP error types, including:

  • PDO SQLSTATE Codes
  • MySQL Error Codes
  • PostgreSQL Error Codes
  • Custom Error Codes

The AppException class automatically inherits the ErrorCodes trait, granting any exception class that extends AppException access to these error constants defined within the ErrorCodes trait.


  • Namespace: \Luminova\Config\Enums\ErrorCodes

1. PHP Error Types

The following constants represent standard PHP error types. They can be used for error handling and logging purposes within the application.

ConstantValueDescription
ERRORE_ERRORFatal run-time errors.
PARSE_ERRORE_PARSECompile-time parse errors.
CORE_ERRORE_CORE_ERRORFatal errors that occur during PHP's initial startup.
COMPILE_ERRORE_COMPILE_ERRORFatal compile-time errors.
WARNINGE_WARNINGRun-time warnings (non-fatal errors).
CORE_WARNINGE_CORE_WARNINGWarnings that occur during PHP's initial startup.
COMPILE_WARNINGE_COMPILE_WARNINGCompile-time warnings.
USER_WARNINGE_USER_WARNINGUser-generated warnings.
NOTICEE_NOTICERun-time notices (non-critical errors).
USER_NOTICEE_USER_NOTICEUser-generated notices.
STRICT_NOTICEE_STRICTSuggestions for code improvements.
USER_ERRORE_USER_ERRORUser-generated fatal errors.
RECOVERABLE_ERRORE_RECOVERABLE_ERRORErrors that can be caught by a catch block.
DEPRECATEDE_DEPRECATEDNotices of deprecated features.
USER_DEPRECATEDE_USER_DEPRECATEDUser-generated notices of deprecated features.

2. PDO SQLSTATE Codes

These constants represent SQLSTATE error codes for PDO. They are useful for handling database connection issues and SQL errors.

ConstantValueDescription
UNABLE_TO_CONNECT08001Unable to connect to the database.
CONNECTION_DENIED08004Connection denied due to invalid credentials.
INTEGRITY_CONSTRAINT_VIOLATION23000Integrity constraint violation, such as foreign key issues.
SQL_SYNTAX_ERROR_OR_ACCESS_VIOLATION42000SQL syntax error or access violation.

3. MySQL Error Codes

The following constants represent common MySQL error codes. These can be used for handling database-specific errors in MySQL.

ConstantValueDescription
ACCESS_DENIED_FOR_USER1044Access denied for the user.
ACCESS_DENIED_INVALID_PASSWORD1045Access denied due to invalid password.
UNKNOWN_DATABASE1049Unknown database specified in the connection.
SYNTAX_ERROR_IN_SQL_STATEMENT1064Syntax error in SQL statement.
TABLE_DOES_NOT_EXIST1146The specified table does not exist.

4. PostgreSQL Error Codes

These constants represent PostgreSQL-specific error codes.

ConstantValueDescription
INVALID_AUTHORIZATION_SPECIFICATION28000Invalid authorization specification.
INVALID_CATALOG_NAME3D000Invalid catalog name (database name).

5. Custom Luminova Error Codes

These constants represent custom error codes defined specifically for the Luminova framework. They cover various aspects of application errors, including database errors, validation errors, and more.

ConstantValueDescription
DATABASE_ERROR1500General database error.
FAILED_ALL_CONNECTION_ATTEMPTS1503Failed all attempts to connect to the database.
CONNECTION_LIMIT_EXCEEDED1509Connection limit exceeded.
INVALID_DATABASE_DRIVER1406Invalid database driver specified.
DATABASE_DRIVER_NOT_AVAILABLE1501Database driver not available.
DATABASE_TRANSACTION_READONLY_FAILED1417Failed to execute a read-only transaction.
DATABASE_TRANSACTION_FAILED1420Database transaction failed.
TRANSACTION_SAVEPOINT_FAILED1418Failed to create a transaction savepoint.
FAILED_TO_ROLLBACK_TRANSACTION1419Failed to rollback the transaction.
NO_STATEMENT_TO_EXECUTE1499No SQL statement to execute.
VALUE_FORBIDDEN1403Forbidden value encountered.
INVALID_ARGUMENTS1001Invalid arguments provided to a function.
INVALID1002General invalid error.
RUNTIME_ERROR5001General runtime error.
CLASS_NOT_FOUND5011Class not found during execution.
STORAGE_ERROR5079General storage error.
VIEW_NOT_FOUND404The requested view could not be found.
INPUT_VALIDATION_ERROR4070Input validation error occurred.
ROUTING_ERROR4161Error in routing the request.
NOT_FOUND4040Requested resource not found.
BAD_METHOD_CALL4051Method call failed due to invalid parameters.
CACHE_ERROR5071Error related to caching.
FILESYSTEM_ERROR6204Filesystem error encountered.
COOKIE_ERROR4961Error related to cookies.
DATETIME_ERROR2306Error in date/time operations.
CRYPTOGRAPHY_ERROR3423Error related to cryptographic operations.
WRITE_PERMISSION_DENIED6205Denied write permission.
READ_PERMISSION_DENIED6206Denied read permission.
READ_WRITE_PERMISSION_DENIED6209Denied read/write permission.
CREATE_DIR_FAILED6207Failed to create a directory.
SET_PERMISSION_FAILED6208Failed to set permissions on a file/directory.
JSON_ERROR4180JSON encoding/decoding error.
SECURITY_ISSUE4973Security issue detected.
MAILER_ERROR449Error related to mailer functionality.
INVALID_CONTROLLER1003Invalid controller specified.
INVALID_METHOD4052Invalid method specified.
INVALID_REQUEST_METHOD4053Invalid request method used.
NOT_ALLOWED4061Operation not allowed.
NOT_SUPPORTED4062Operation not supported.
LOGIC_ERROR4229Logical error in the application.
UNDEFINED8790Undefined error occurred.
HTTP_CLIENT_ERROR4974Client error occurred during an HTTP request.
HTTP_CONNECTION_ERROR4975Connection error during HTTP request.
HTTP_REQUEST_ERROR4976Error during HTTP request processing.
HTTP_SERVER_ERROR4977Server error occurred while processing HTTP request.

6. SQLite Error Codes

These constants represent SQLite-specific error codes for database operations.

ConstantValueDescription
DATABASE_IS_FULL5The database is full.
DATABASE_LOCKED6The