Exceptions
Every client-facing exception extends the abstract Exceptions\EventsException (a RuntimeException). errorCode() is the stable code, status() the HTTP status the API answers with, and getMessage() is already the client-safe text — translated into the current locale (events::messages, en and sk), never naming a class, key or table. In your own controllers:
use RoundlyConsulting\Events\Exceptions\EventsException;
try {
$rsvp = Events::for($event)->rsvp($request->user())->by($request->user())->going(tier: $request->input('tier'));
} catch (EventsException $e) {
return response()->json(['message' => $e->getMessage(), 'code' => $e->errorCode()], $e->status());
}| Exception | code | HTTP | Thrown when |
|---|---|---|---|
EventNotFoundException | event_not_found | 404 | An unknown, trashed or (over the API) hidden event; a calendar file for a viewer who may not see the event. |
VenueNotFoundException · TierNotFoundException | venue_not_found · tier_not_found | 404 | A ticket type of another event, or an unknown key or id. |
RsvpNotFoundException | rsvp_not_found | 404 | An RSVP of another event; an unknown or superseded payment reference; a check-in for an attendee whose row is gone. |
InvalidEventException | invalid_event | 422 | Title missing or too long, a bad join link, a mode that disagrees with venue and link, a new start on an announced event, deleting an event people are going to, bad reminders, no organizer, a taken manual slug, moving a finished event online, an invitation message over 1000. |
InvalidEventScheduleException | invalid_schedule | 422 | No start, end before start, too long, doors outside the 12 hours before the start, a bad timezone, date-time or duration, a time in a DST gap, a bad all-day range or RSVP window. |
InvalidVenueException | invalid_venue / venue_in_use | 422 | No name, bad coordinates, a bad country code, a radius out of range / deleting a venue an unfinished event uses. |
InvalidTierException | invalid_tier / tier_key_taken / tier_in_use | 422 | Bad name, key, party limits, sale window, capacity, price or reorder / a taken key / removing a ticket type in use. |
InvalidGuestCountException · TierRequiredException | invalid_guest_count · tier_required | 422 | Guests outside the limits · going() without a ticket type while several are on sale. |
TierNotOnSaleException · EventFullException · TierSoldOutException | tier_not_on_sale · event_full · tier_sold_out | 409 | A newly picked type outside its sale · no seats and no waitlist. |
RsvpClosedException | rsvp_closed | 409 | RSVPs closed or not open yet, the event started, cancelled or completed — and a payment from the start on (refund it). |
InvitationRequiredException | invitation_required | 403 | Answering a private event without an invitation. |
InvalidRsvpTransitionException | invalid_rsvp_transition | 409 | A checked-in attendee declining or shrinking below the guests through the door, a paid seat changed by answering, confirming or releasing what is not held, checking in what is not going. |
RsvpHoldExpiredException | hold_expired | 409 | A late payment with no seats left. |
InvalidCheckInCodeException · CheckInRefusedException | invalid_code · check_in_refused | 404 · 409 | See Check-in at the door. |
InvalidInvitationException | invalid_invitation | 404 | An unknown, malformed, revoked, expired or used token, or someone else’s link — uniform. |
EventTrashedException | event_trashed | 409 | Any write to a trashed event. |
UnknownEventTransitionException · EventTransitionDeniedException | unknown_transition · transition_denied | 422 (429) | A verb the lifecycle does not offer · lifecycle refused (denials(), retryAfterSeconds(), previousDenial()). |
InvalidOrganizerException · UnknownMorphAliasException · InvalidEventQueryException | invalid_organizer · unknown_alias · invalid_query | 422 (400) | Organizing as someone who does not allow the actor · an unknown API alias or key · a bad API filter value. |
EventTransitionDeniedException also has denials() (lifecycle’s denial codes plus no_attendees and rescheduled_through_events), retryAfterSeconds() (0 unless rate limited; the API sends Retry-After) and previousDenial(). CheckInRefusedException::reason() is one of the constants WRONG_EVENT, NOT_GOING, EVENT_NOT_ACTIVE and OUTSIDE_WINDOW.
Errors the API maps from elsewhere
| Source | API answer |
|---|---|
| Laravel’s AuthorizationException | 403 forbidden |
| lifecycle’s SubjectTrashedException | 409 event_trashed |
| tags’ TagNotFoundException, TagScopeMismatchException | 422 tag_not_found |
| tags’ TagLimitExceededException | 422 tag_limit_exceeded |
| tags’ InvalidTagException, TagTypeMismatchException, TagTypeNotAllowedException, UnknownTagTypeException | 422 invalid_tag |
| media-library’s FileUnacceptableForBucket, DraftMediaNotFound, DraftMediaExpired | 422 invalid_poster |
| Validation | 422 validation_failed + errors |
In PHP these pass through unchanged.
Configuration errors
These are the host’s to fix: English, naming the key, and extending the toolkit’s PackageToolkitException. InvalidEventsConfigurationException covers a bad duration, timezone, table name, time of day, URL template or choice — outOfRange() for a value outside its bounds, tooMany() for more than five reminder offsets and keyTypeMismatch() when a model’s key does not fit events.key_type, raised before any SQL. InvalidEventLifecycleException covers an events.lifecycle value that is not a LifecycleDefinition implementing Contracts\EventLifecycle, or one that breaks the contract. The toolkit’s own InvalidConfigurationException covers a model, resource, notification class or list that is not what its key needs.
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 cryptoBy 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.