| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* Thrown by runRedirectsForViewStaged() / runRedirectsForViewCountStaged() |
| 9 |
* when the precomputed view_done table is missing or invalidated. |
| 10 |
* |
| 11 |
* Distinct from ABJ_404_Solution_ViewQueryFailureException: a query *failure* |
| 12 |
* is a real error worth surfacing diagnostics for. A *pending* build is the |
| 13 |
* normal cold-start state. view_done has not yet been built, the AJAX gate |
| 14 |
* is supposed to translate this into a `viewBuildPending` response, and |
| 15 |
* background cron / the JS poller will advance the build. |
| 16 |
* |
| 17 |
* This class lets callers (getRedirectsForView, getRedirectsForViewCount, |
| 18 |
* the warmup pipeline, and tests) match on "build-not-ready" specifically |
| 19 |
* without conflating it with infrastructure errors. Carries the current |
| 20 |
* progress text so admin notices can render the same state the AJAX |
| 21 |
* progress response shows. |
| 22 |
*/ |
| 23 |
class ABJ_404_Solution_ViewBuildPendingException extends Exception { |
| 24 |
|
| 25 |
/** @var string */ |
| 26 |
private $progressText; |
| 27 |
|
| 28 |
/** |
| 29 |
* @param string $message |
| 30 |
* @param string $progressText |
| 31 |
* @param Throwable|null $previous |
| 32 |
*/ |
| 33 |
public function __construct(string $message, string $progressText = '', ?Throwable $previous = null) { |
| 34 |
parent::__construct($message, 0, $previous); |
| 35 |
$this->progressText = $progressText; |
| 36 |
} |
| 37 |
|
| 38 |
/** @return string */ |
| 39 |
public function getProgressText(): string { |
| 40 |
return $this->progressText; |
| 41 |
} |
| 42 |
} |
| 43 |
|