NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages

Every package exception extends ReportsException, itself a RuntimeException, so you can catch them individually or together:

ExceptionThrown whenCarries
DuplicateReportExceptionprevent_duplicates blocks a repeat report.existing
InvalidStatusTransitionExceptionA status move — changeStatus(), review(), close(), changeStatusTo(), resolve or reject — is undeclared while strict_transitions is on.report, from, to
UnknownReportReasonExceptionThe reason is not in the allowed list and allow_unknown_reasons is false.slug, allowed
MissingModeratorsExceptionReports::moderate(...)->open() is called without moderators.—
ModeratorRequiredExceptionA report under moderation is resolved, rejected or moved out of the open statuses by anyone but a named moderator (or a delegate of one), or without an actor. Nothing is written.report, actor
MissingPruneWindowExceptionReports::prune() runs with no $days and no prune_after_days.—
ReportsExceptionBase class of all of the above; extends RuntimeException.—
use RoundlyConsulting\Reports\Exceptions\ReportsException;
use RoundlyConsulting\Reports\Exceptions\UnknownReportReasonException;

try {
    Reports::report($post)->by($user)->for($slug)->create();
} catch (UnknownReportReasonException $e) {
    $e->slug;     // the rejected slug
    $e->allowed;  // list<string> — the allowed slugs
} catch (ReportsException $e) {
    // any other package exception, e.g. DuplicateReportException
}

Creating a report without a subject — a PendingReport started with Reports::from() and no about() — throws a plain LogicException.

Two failures come from the packages underneath and do not extend ReportsException: an invalid config value — threshold, prune_after_days, the moderation defaults, duplicate_scope, table, reasons, key_type or model (see Configuration) — throws the toolkit’s InvalidConfigurationException, and opening moderation with an unsaved moderator or a quorum above the moderator count throws the approvals engine’s InvalidApprovalRequestException.

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

By donating, you agree to our donation terms.

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.