---
title: "Exceptions — Campaigns for Laravel | Roundly"
description: "CampaignNotFound, CampaignAlreadyExists, InvalidCampaignTransition, RecipientNotFound, config and builder argument errors — and when each occurs."
url: https://roundly-consulting.com/open-source/docs/campaigns-for-laravel/exceptions
language: en
---

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

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

# Exceptions

The package’s exceptions live in RoundlyConsulting\\Campaigns\\Exceptions and extend CampaignException, a RuntimeException:

| Exception | Thrown when |
| --- | --- |
| `CampaignNotFound` | findOrFail(), campaign(), start() or cancel() — and campaigns:cancel — got an unknown uuid. find() returns null instead. |
| `CampaignAlreadyExists` | prepare() — or the builder’s prepare()/dispatch() — got a uuid another campaign already holds, live or soft-deleted. The existing campaign is left untouched. |
| `InvalidCampaignTransition` | start() on a campaign that isn’t Pending — already sending, or ended — or one another process started first, instead of queueing every recipient twice. |
| `RecipientNotFound` | A handle’s recipient(), markProcessed() or markFailed() got an unknown recipient or one of another campaign. |
| `CampaignException` | Base class of the package’s exceptions. SendCampaignNotification throws it when campaigns.notification is unset — caught and recorded as a failed recipient. |
| `InvalidConfigurationException` | A config value is present but unusable — see Configuration. From RoundlyConsulting\\PackageToolkit\\Exceptions; it does not extend CampaignException. |
| `InvalidArgumentException` | \->to() got something other than a string, CampaignRecipient, Contact or HasContacts owner. |
| `ValueError` | \->viaContactType() got a string that isn’t a ContactType value. |

```php
use RoundlyConsulting\Campaigns\Exceptions\CampaignNotFound;
use RoundlyConsulting\Campaigns\Facades\Campaigns;

try {
    Campaigns::cancel($uuid);
} catch (CampaignNotFound $e) {
    report($e); // "No campaign found for uuid [...]."
}
```

Delivery errors never surface as exceptions: the recipient jobs catch them and record them on the recipient, where errorOccured and errorMessage tell you what went wrong.

## 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/campaigns-for-laravel.md)
