---
title: "Exceptions & translations — Requests for Laravel | Roundly"
description: "One RequestException hierarchy with typed subclasses and translatable messages in English and Slovak."
url: https://roundly-consulting.com/open-source/docs/requests-for-laravel/exceptions
language: en
---

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

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

# Exceptions & translations

All package exceptions extend RoundlyConsulting\\Requests\\Exceptions\\RequestException (a RuntimeException), so you can catch the whole hierarchy at once:

```php
use RoundlyConsulting\Requests\Exceptions\InvalidStatusTransition;
use RoundlyConsulting\Requests\Exceptions\RequestException;

try {
    Requests::approve($request, $alice);
} catch (InvalidStatusTransition $e) {
    $e->getMessage(); // 'Cannot transition a request from Rejected to Approved.'
} catch (RequestException $e) {
    // any other package exception
}
```

- InvalidStatusTransition — thrown by the guard when enforce\_transitions is on and a move is illegal. Carries $from and $to.
- RequestAlreadyResolved — thrown, whatever enforce\_transitions says, for acting on a request that can’t take the action: any move out of Cancelled, anything but reopen() on an Expired request (cancel() included), approve() / reject() once the approval round has resolved, and approve() / reject() on a request past its deadline, which is expired first. Carries $status.
- InvalidApprover — an approver that isn’t an Eloquent model (a bare id), or a declared approver that no longer exists when a reopened request replays its round.

The approvals engine’s own exceptions pass through unchanged — notably UnauthorizedApprovalException for an actor who isn’t a declared approver (or whom the approvals gate denies a reopen()), ClosedApprovalRequestException for a decision made straight on a request whose round is over, and InvalidApprovalRequestException for a round that can’t open (an unsaved approver, flat approvers mixed with stages(), an unreachable quorum).

```php
use RoundlyConsulting\Requests\Exceptions\InvalidApprover;
use RoundlyConsulting\Requests\Exceptions\RequestAlreadyResolved;

try {
    Requests::approve($cancelledRequest, $alice);
} catch (RequestAlreadyResolved $e) {
    $e->status;   // Status::Cancelled — a cancelled request is final
}

Requests::make()->requireApprovalsFrom([$alice->id]);   // throws InvalidApprover — a bare id names no model type
```

## Translations

Messages are translatable via the requests::messages namespace, which loads automatically and ships in English and Slovak — Laravel picks the app locale’s lines. Publish them with the requests-translations tag (lang/vendor/requests/{en,sk}/messages.php) only to override a message or add a locale:

```php
// lang/vendor/requests/en/messages.php
return [
    'invalid_status_transition' => 'Cannot transition a request from :from to :to.',
    'request_already_resolved' => 'The request is already resolved (:status) and cannot be changed.',
    'approver_not_a_model' => 'An approver must be an Eloquent model, :type given: a bare id names no model type, so it could not be enforced.',
    'approver_missing' => 'The approval round cannot be reopened: approver :type #:id no longer exists.',
];
```

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