PHPackages                             qubus/error - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. qubus/error

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

qubus/error
===========

Package for Error handling.

v3.0.1(8mo ago)01151MITPHPPHP &gt;=8.4

Since Aug 30Pushed 8mo agoCompare

[ Source](https://github.com/QubusPHP/error)[ Packagist](https://packagist.org/packages/qubus/error)[ Docs](https://github.com/QubusPHP/error)[ RSS](/packages/qubus-error/feed)WikiDiscussions 3.x Synced 3w ago

READMEChangelogDependencies (3)Versions (11)Used By (1)

Error Handler
=============

[](#error-handler)

Error handling with PSR-3 logging for catching exceptions as well as errors. There is also an error class to use as an alternative to throwing an exception.

Example
-------

[](#example)

```
use Qubus\Error\Error;

use function Qubus\Error\Helpers\is_error;

function get_current_user(string|int $id = null)
{
    if(null === $id) {
        return new Error('User id cannot be null.');
    }
}

$user = get_current_user('56');

if(is_error($user)) {
    // log error message or send error flash message back to the user.
}
```

Requirements
------------

[](#requirements)

- PHP 8.4+

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

[](#installation)

```
$ composer require qubus/error
```

Exceptions vs. Errors
---------------------

[](#exceptions-vs-errors)

There is a healthy discussion among developers whether to use exceptions or error return codes. There are pros and cons to both sides. No matter what side you fall on, the articles below are a great read with a dose of great examples as to the proper use of exceptions.

- [Exception Handling Considered Harmful](http://www.lighterra.com/papers/exceptionsharmful/)
- [Why is exception handling bad?](https://stackoverflow.com/questions/1736146/why-is-exception-handling-bad)
    - "The rule of thumb is that exceptions should flag exceptional conditions, and that you should not use them for control of program flow."
- [Why I Hate Exceptions](http://xahlee.info/comp/why_i_hate_exceptions.html)
- [Structured Exception Handling Considered Harmful](https://docs.microsoft.com/en-us/archive/blogs/larryosterman/structured-exception-handling-considered-harmful)
- [Exceptions](https://www.joelonsoftware.com/2003/10/13/13/)
- [Why You Should Avoid Using Exceptions as the Control Flow in Java](https://dzone.com/articles/exceptions-as-controlflow-in-java)
- [Exceptional Exceptions, Demystified - Part 1](https://www.linkedin.com/pulse/exceptional-exceptions-demystified-part-i-ivan-pointer)
- [Exceptional Exceptions, Demystified - Part 2](https://www.linkedin.com/pulse/exceptional-exceptions-demystified-part-2-ivan-pointer)
- [Exceptional Exceptions Demystified - Part 3](https://www.linkedin.com/pulse/exceptional-exceptions-demystified-part-3-ivan-pointer?_l=en_US)

Author Statement
----------------

[](#author-statement)

I am of the mind that if a function is to return something, then it should return, not throw. If an exception is exceptional, it should be caught and logged. I know that I don't do this perfectly, but it is my goal to go through all of my code and make sure that exceptions are exceptional and not unexceptional.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance58

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~141 days

Recently: every ~10 days

Total

9

Last Release

265d ago

Major Versions

1.0.x-dev → v2.0.02023-08-28

v2.0.2 → v3.0.02025-08-31

PHP version history (3 changes)v1.0.0PHP &gt;=8.1

v2.0.0PHP &gt;=8.2

v3.0.0PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/86d25d805eb5b710fab925600008b72f9f5f11a5206154fcd1ded01794a4d1b8?d=identicon)[nomadicjosh](/maintainers/nomadicjosh)

---

Top Contributors

[![nomadicjosh](https://avatars.githubusercontent.com/u/2042176?v=4)](https://github.com/nomadicjosh "nomadicjosh (15 commits)")

---

Tags

errorerror-handlererror handling

### Embed Badge

![Health badge](/badges/qubus-error/health.svg)

```
[![Health](https://phpackages.com/badges/qubus-error/health.svg)](https://phpackages.com/packages/qubus-error)
```

###  Alternatives

[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k240.0M314](/packages/sentry-sentry)[sentry/sentry-laravel

Laravel SDK for Sentry (https://sentry.io)

1.3k122.6M185](/packages/sentry-sentry-laravel)[sentry/sdk

This is a meta package of sentry/sentry. We recommend using sentry/sentry directly.

327137.6M163](/packages/sentry-sdk)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[e2ex/e2ex

Converts PHP Errors to Exceptions and (optionally) logs PHP Errors, Notices and Warnings with a PSR-3 compatible logger

101.5k](/packages/e2ex-e2ex)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
