-
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathInvalidStatusException.php
More file actions
48 lines (39 loc) · 1.19 KB
/
InvalidStatusException.php
File metadata and controls
48 lines (39 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
declare(strict_types=1);
namespace Yiisoft\Queue\Exception;
use InvalidArgumentException;
use Throwable;
use Yiisoft\FriendlyException\FriendlyExceptionInterface;
class InvalidStatusException extends InvalidArgumentException implements FriendlyExceptionInterface
{
private int $status;
public function __construct(int $status, string $message = '', int $code = 0, Throwable $previous = null)
{
if ($message === '') {
$message = "Invalid status provided: $status";
}
parent::__construct($message, $code, $previous);
$this->status = $status;
}
public function getName(): string
{
return 'Invalid job status provided';
}
public function getSolution(): ?string
{
return <<<SOLUTION
Default available status values are:
[1] JobStatus::WAITING
[2] JobStatus::RESERVED
[3] JobStatus::DONE
Please consider using one of them or extending \Yiisoft\Queue\Enum\JobStatus class with your ows values.
SOLUTION;
}
/**
* Get the wrong status value
*/
public function getStatus(): int
{
return $this->status;
}
}