| @@ -7,9 +7,23 @@ | ||
| 7 | 7 | defined('ABSPATH') || exit; |
| 8 | 8 | |
| 9 | 9 | abstract class JobException extends Exception |
| 10 | 10 | { |
| 11 | + /** @var array|null Raw (decoded) API response body attached to this error, when available. */ | |
| 12 | + protected $responseData = null; | |
| 13 | + | |
| 11 | 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 | + } | |
| 12 | 26 | |
| 13 | 27 | public function getErrorContext(): array |
| 14 | 28 | { |
| 15 | 29 | return [ |