PHPackages                             kariricode/exception - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. kariricode/exception

ActiveLibrary[Framework](/categories/framework)

kariricode/exception
====================

KaririCode Exception provides a robust and modular exception handling system for the KaririCode Framework, enabling seamless error management across various application domains.

v1.2.4(11mo ago)01.2k3MITPHPPHP ^8.3CI passing

Since Oct 16Pushed 11mo agoCompare

[ Source](https://github.com/KaririCode-Framework/kariricode-exception)[ Packagist](https://packagist.org/packages/kariricode/exception)[ Docs](https://kariricode.org)[ RSS](/packages/kariricode-exception/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (6)Dependencies (5)Versions (8)Used By (3)

KaririCode Framework: Exception Component
=========================================

[](#kariricode-framework-exception-component)

[![en](https://camo.githubusercontent.com/9687410941adb91c2f673c9d50ef38544f3e9a38a6b9f9367cac918a8d3e2a41/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c616e672d656e2d7265642e737667)](README.md) [![pt-br](https://camo.githubusercontent.com/03443f2a7a42ea03f0747d7bb784c5e42ee3f2c09e27bab66436a5021cc05c0c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c616e672d70742d2d62722d677265656e2e737667)](README.pt-br.md)

[![PHP](https://camo.githubusercontent.com/d282cc3193faee11ee32307d0c4c9d809e8fafa4b3a8c12c6afbf35d4f7ec617/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d3737374242343f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/d282cc3193faee11ee32307d0c4c9d809e8fafa4b3a8c12c6afbf35d4f7ec617/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d3737374242343f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465) [![Docker](https://camo.githubusercontent.com/85e3ff712bb08b8e5595b34ecddfd189a51b20f61988aa467a56c5da9a107dda/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f636b65722d3234393645443f7374796c653d666f722d7468652d6261646765266c6f676f3d646f636b6572266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/85e3ff712bb08b8e5595b34ecddfd189a51b20f61988aa467a56c5da9a107dda/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f636b65722d3234393645443f7374796c653d666f722d7468652d6261646765266c6f676f3d646f636b6572266c6f676f436f6c6f723d7768697465) [![PHPUnit](https://camo.githubusercontent.com/1a5b56ac6730778e61f15bacc6ddfb8a38d571dd3e3207bcc8f7b60707fd37b0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f504850556e69742d3337373641423f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/1a5b56ac6730778e61f15bacc6ddfb8a38d571dd3e3207bcc8f7b60707fd37b0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f504850556e69742d3337373641423f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465)

A comprehensive and flexible exception handling component for PHP, part of the KaririCode Framework. It provides a structured approach to error management, enhancing the robustness and maintainability of your applications.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
    - [Basic Usage](#basic-usage)
    - [Advanced Usage](#advanced-usage)
- [Error Code Range Table](#error-code-range-table)
- [Available Exception Types](#available-exception-types)
- [Integration with Other KaririCode Components](#integration-with-other-kariricode-components)
- [Development and Testing](#development-and-testing)
- [License](#license)
- [Support and Community](#support-and-community)

Features
--------

[](#features)

- Hierarchical exception structure for better error categorization
- Context-aware exceptions for richer error information
- Static factory methods for easy exception creation
- Integration with KaririCode's error handling and logging systems
- Extensible architecture allowing custom exception types
- Comprehensive set of pre-defined exception types for common scenarios

Installation
------------

[](#installation)

You can install the Exception component via Composer:

```
composer require kariricode/exception
```

### Requirements

[](#requirements)

- PHP 8.1 or higher
- Composer

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

#### Using Pre-defined Exceptions in Your Code

[](#using-pre-defined-exceptions-in-your-code)

The KaririCode Exception component provides a variety of pre-defined exceptions that you can use to handle common error scenarios in a professional and structured manner. Below is an example of how to use these exceptions in an object-oriented context.

```
