---
title: "Exceptions — Notifications for Laravel | Roundly"
description: "Every domain exception with its stable code and HTTP status, the configuration exceptions, and how to map them in your own API."
url: https://roundly-consulting.com/open-source/docs/notifications-for-laravel/exceptions
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Notifications for Laravel](https://roundly-consulting.com/open-source/docs/notifications-for-laravel.md)

# Exceptions

Every domain exception extends NotificationsException (a RuntimeException) and carries a translated message, a stable machine code (errorCode()) and an HTTP status (status()), so a host API maps them without matching message text. Messages name type keys and model basenames, never a PHP class:

```php
use RoundlyConsulting\Notifications\Exceptions\NotificationsException;

try {
    Notifications::preferences($user)->mute('security.alert');
} catch (NotificationsException $e) {
    $e->errorCode();    // 'mandatory_notification'
    $e->status();       // 422
    $e->getMessage();   // translated: The notification "security.alert" is required and cannot be switched off.
}
```

| Exception | Code | HTTP | When |
| --- | --- | --- | --- |
| `UnknownNotificationTypeException` | `unknown_type` | 422 | A type key nobody registered. |
| `InvalidNotificationTypeException` | `invalid_type` | 422 | A type that cannot work, at registration (see Notification types). |
| `DuplicateNotificationTypeException` | `duplicate_type` | 422 | One key registered twice, naming both sources. |
| `InvalidNotificationSubjectException` | `invalid_subject` | 422 | A subject of another class; a subject for a type without one; no subject where one is needed (an escalation). |
| `InvalidNotificationDataException` | `invalid_data` | 422 | Data that is not plain JSON (naming the path) or over max\_data\_bytes; a bad context; an unknown channel. |
| `InvalidRecipientException` | `invalid_recipient` | 422 | A recipient that is not an Eloquent model. |
| `UnresolvableRecipientsException` | `unresolvable_recipients` | 422 | A group that implements no ProvidesNotificationRecipients under the default resolver. |
| `UnstorableRecipientsException` | `unstorable_recipients` | 422 | A closure (or non-scalar resolver arguments) where recipients must be stored. |
| `NoOwnerException` | `no_owner` | 422 | Recipients::owner() without a subject, or a subject that names no owner. |
| `MissingAccessCheckException` | `missing_access_check` | 500 | The default access check on a subject with neither a policy nor the ability. |
| `MandatoryNotificationException` | `mandatory_notification` | 422 | A write that would mute a mandatory type. |
| `UnknownNotificationCategoryException` | `unknown_notification_category` | 422 | A category no registered type uses. |
| `InboxItemNotFoundException` | `inbox_item_not_found` | 404 | A missing id or another recipient’s item — the same answer. |
| `InvalidQuietHoursException` | `invalid_quiet_hours` | 422 | Equal start and end, or a time that is not HH:MM. |
| `InvalidTimezoneException` | `invalid_timezone` | 422 | Not an IANA timezone. |
| `InvalidReminderRuleException` | `invalid_reminder` | 422 | A rule that cannot work, or an unreadable or non-positive escalation delay. |
| `InvalidInteropMappingException` | `invalid_interop_mapping` | 500 | A mapping to an unknown type, or a time-critical class mapped to a type that is not urgent, windowless and non-digestible. |

Configuration errors throw InvalidNotificationsConfigurationException (English, naming the key; it extends package-toolkit’s base exception) or the toolkit’s InvalidConfigurationException.

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/notifications-for-laravel.md)
