| 1 |
<?php |
| 2 |
|
| 3 |
namespace SyncBasalam\Jobs\Exceptions; |
| 4 |
|
| 5 |
use Exception; |
| 6 |
|
| 7 |
defined('ABSPATH') || exit; |
| 8 |
|
| 9 |
abstract class JobException extends Exception |
| 10 |
{ |
| 11 |
/** @var array|null Raw (decoded) API response body attached to this error, when available. */ |
| 12 |
protected $responseData = null; |
| 13 |
|
| 14 |
abstract public function shouldRetry(): bool; |
| 15 |
|
| 16 |
public function setResponseData(?array $responseData): self |
| 17 |
{ |
| 18 |
$this->responseData = $responseData; |
| 19 |
return $this; |
| 20 |
} |
| 21 |
|
| 22 |
public function getResponseData(): ?array |
| 23 |
{ |
| 24 |
return $this->responseData; |
| 25 |
} |
| 26 |
|
| 27 |
public function getErrorContext(): array |
| 28 |
{ |
| 29 |
return [ |
| 30 |
'message' => $this->getMessage(), |
| 31 |
'code' => $this->getCode(), |
| 32 |
'file' => $this->getFile(), |
| 33 |
'line' => $this->getLine(), |
| 34 |
]; |
| 35 |
} |
| 36 |
} |
| 37 |
|