Exception Contracts

The exception surface is split into marker interfaces, concrete subsystem exceptions, and debug-time conversion boundaries. These declarations define types and message factories; they do not prove that an exception path has been reached or observed in production.

Exception type relationships

Type Source-defined declaration Relationship
CodeIgniter\Exceptions\ExceptionInterface Empty interface in imspr/system/Exceptions/ExceptionInterface.php No declared methods or parent interface
CodeIgniter\Cache\Exceptions\ExceptionInterface Empty interface in imspr/system/Cache/Exceptions/ExceptionInterface.php No declared methods or parent interface; it is not declared as extending the core marker
CodeIgniter\Cache\Exceptions\CacheException Class in imspr/system/Cache/Exceptions/CacheException.php Extends \RuntimeException and implements the cache exception interface
CodeIgniter\Database\Exceptions\ExceptionInterface Empty interface in imspr/system/Database/Exceptions/ExceptionInterface.php Extends \CodeIgniter\Exceptions\ExceptionInterface
CodeIgniter\Database\Exceptions\DataException Class in imspr/system/Database/Exceptions/DataException.php Extends \RuntimeException and implements the database exception interface
Laminas\Escaper\Exception\ExceptionInterface Empty interface in imspr/system/ThirdParty/Escaper/Exception/ExceptionInterface.php No declared methods or parent interface; it is not declared as extending a CodeIgniter marker
CodeIgniter\View\Exceptions\ViewException Class in imspr/system/View/Exceptions/ViewException.php Extends FrameworkException and implements the core CodeIgniter exception interface
Dompdf\Exception Class in pdf/src/Exception.php Extends native \Exception; its constructor accepts optional message and code values

The cache and Escaper marker interfaces are separate source-defined contracts. Do not treat them as interchangeable with the core CodeIgniter marker without additional evidence.

Subsystem factories

[
    {
        "title": "CacheException — cache failures",
        "body": "Source: imspr/system/Cache/Exceptions/CacheException.php. **forUnableToWrite(string $path)** constructs a CacheException from `lang('Cache.unableToWrite', [$path])`. **forInvalidHandlers()** uses `lang('Cache.invalidHandlers')`. **forNoBackup()** uses `lang('Cache.noBackup')`. **forHandlerNotFound()** uses `lang('Cache.handlerNotFound')`."
    },
    {
        "title": "DataException — database data conditions",
        "body": "Source: imspr/system/Database/Exceptions/DataException.php. **forInvalidMethodTriggered(string $method)** uses `lang('Database.invalidEvent', [$method])`. **forEmptyDataset(string $mode)** uses `lang('Database.emptyDataset', [$mode])`. **forInvalidArgument(string $argument)** uses `lang('Database.invalidArgument', [$argument])`. **forInvalidAllowedFields(string $model)** uses `lang('Database.invalidAllowedFields', [$model])`. **forTableNotFound(string $table)** uses `lang('Database.tableNotFound', [$table])`. **forEmptyInputGiven(string $argument)** uses `lang('Database.forEmptyInputGiven', [$argument])`. **forFindColumnHaveMultipleColumns()** uses `lang('Database.forFindColumnHaveMultipleColumns')`."
    },
    {
        "title": "ViewException — view-cell and tag errors",
        "body": "Source: imspr/system/View/Exceptions/ViewException.php. **forInvalidCellMethod(string $class, string $method)** uses `lang('View.invalidCellMethod', ['class' => $class, 'method' => $method])`. **forMissingCellParameters(string $class, string $method)** uses `lang('View.missingCellParameters', ['class' => $class, 'method' => $method])`. **forInvalidCellParameter(string $key)** uses `lang('View.invalidCellParameter', [$key])`. **forNoCellClass()** uses `lang('View.noCellClass')`. **forInvalidCellClass(string $class = null)** uses `lang('View.invalidCellClass', [$class])`. **forTagSyntaxError(string $output)** uses `lang('View.tagSyntaxError', [$output])`."
    }
]

These factories define parameter shapes and localized message construction. The inspected declarations do not establish which factories are called at runtime.

Debug conversion boundaries

Exceptions::initialize in imspr/system/Debug/Exceptions.php source-defines three callback registrations:

flowchart TD
    init["Exceptions::initialize"]
    exceptionReg["set_exception_handler"]
    errorReg["set_error_handler"]
    shutdownReg["register_shutdown_function"]
    exceptionHandler["Exceptions::exceptionHandler"]
    errorHandler["Exceptions::errorHandler"]
    severity["error_reporting() severity check"]
    errorException["ErrorException"]
    shutdown["Exceptions::shutdownHandler"]
    lastError["error_get_last()"]
    fatalGuard["Fatal error type check"]

    init --> exceptionReg
    init --> errorReg
    init --> shutdownReg
    exceptionReg --> exceptionHandler
    errorReg --> errorHandler
    errorHandler --> severity
    severity -->|enabled| errorException
    shutdownReg --> shutdown
    shutdown --> lastError
    lastError --> fatalGuard
    fatalGuard -->|fatal type| errorException
    errorException --> exceptionHandler
  • errorHandler returns when the supplied severity is not enabled by error_reporting(). For an enabled severity, it constructs and throws ErrorException with the message, severity, file, and line values.
  • shutdownHandler reads error_get_last(). It converts only E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, or E_PARSE results into an ErrorException, then passes that exception to exceptionHandler.
  • These are source-defined registrations and call relationships, not evidence of runtime reachability or a successful production exception run.

[!NOTE] Exception contracts stop before presentation. The CLI template imspr/app/Views/errors/cli/error_exception.php reads the exception class, message, filename, line number, and—when SHOW_DEBUG_BACKTRACE is enabled—the trace. Rendering behavior belongs to the error-presentation surface, not to these exception declarations.

Updated