phpvms/app/Exceptions/PirepCancelNotAllowed.php
Arthur Parienté 992b6d343a
[8.x] feature: upgrade to Laravel 13 (#2204)
* upgrade to laravel 13

* phpstan

* rollback to symfony 7.4

* fix: ModuleService merge

* refactor: new rector rules
2026-05-06 11:27:21 -05:00

41 lines
780 B
PHP

<?php
declare(strict_types=1);
namespace App\Exceptions;
use App\Models\Pirep;
class PirepCancelNotAllowed extends AbstractHttpException
{
public function __construct(
private readonly Pirep $pirep
) {
parent::__construct(
400,
"This PIREP can't be cancelled"
);
}
/**
* Return the RFC 7807 error type (without the URL root)
*/
public function getErrorType(): string
{
return 'pirep-cancel-not-allowed';
}
public function getErrorDetails(): string
{
return $this->getMessage();
}
public function getErrorMetadata(): array
{
return [
'pirep_id' => $this->pirep->id,
'state' => $this->pirep->state,
];
}
}