horde/exception

Exception handler library

Maintainers

Package info

github.com/horde/Exception

Homepage

pkg:composer/horde/exception

Statistics

Installs: 16 266

Dependents: 114

Suggesters: 1

Stars: 1

v3.0.0beta5 2026-04-17 00:00 UTC

README

Exception handling library for the Horde Project.

Provides a set of exception base classes that integrate with the Horde framework. All exceptions implement HordeThrowable (details support) and LogThrowable (log-level tracking), and extend PHP's SPL exception hierarchy for proper semantic categorisation.

Installation

composer require horde/exception

Quick Start

use Horde\Exception\HordeRuntimeException;
use Horde\Exception\HordeThrowable;

// Throw a typed exception
throw new HordeRuntimeException('Connection failed', 0, $previous);

// Catch any Horde exception via the interface
try {
    // ...
} catch (HordeThrowable $e) {
    echo $e->getMessage();
    echo $e->getDetails();
}

Choosing an Exception Base Class

Error type Base class
Runtime / I/O failure HordeRuntimeException
Invalid argument from caller HordeInvalidArgumentException
Programmer logic error HordeLogicException
Domain rule violation HordeDomainException
Resource not found NotFound
Permission denied PermissionDenied
Generic / uncategorised HordeException

Component exceptions should extend the SPL-based class that best fits (e.g. class CacheException extends HordeRuntimeException {}).

See doc/USAGE.md for the full use-case table, guidance on Wrapped vs standard exceptions, and component exception patterns.

Documentation

  • doc/USAGE.md — Choosing the right base class, the Wrapped pitfall, creating component exceptions
  • doc/UPGRADING.md — Migrating from PSR-0 to PSR-4, class mapping table, breaking changes

License

LGPL-2.1-only. See LICENSE for details.