| 1 | <?php |
||
| 11 | final class FailedJob implements NamedMessage |
||
| 12 | { |
||
| 13 | private $job; |
||
| 14 | |||
| 15 | 6 | public function __construct(Job $job) |
|
| 16 | { |
||
| 17 | if (!$job->isFailed()) { |
||
| 18 | throw new \LogicException('Job is not marked as failed.'); |
||
| 19 | } |
||
| 20 | |||
| 21 | 6 | $this->job = $job; |
|
| 22 | 1 | } |
|
| 23 | |||
| 24 | /** |
||
| 25 | * @return Job |
||
| 26 | */ |
||
| 27 | 2 | public function job() |
|
| 31 | |||
| 32 | /** |
||
| 33 | * @return \Exception |
||
| 34 | */ |
||
| 35 | public function exception() |
||
| 36 | { |
||
| 37 | return $this->job->failedException(); |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * {@inheritdoc} |
||
| 42 | */ |
||
| 43 | 1 | public static function messageName() |
|
| 47 | } |
||
| 48 |