When a provider's API was down (5xx, timeout, DNS), the hourly RefreshSocialToken job and daily VerifyWorkspaceConnections job were treating it as "token revoked" and emailing the user to reconnect. Bluesky going offline triggered false-positive disconnect notifications because Bluesky access tokens are short-lived (2h) so every hourly refresh failed during the outage. - New PlatformUnavailableException: API unreachable / 5xx, transient. TokenExpiredException stays for 4xx (token is provably bad). - New TokenRefreshClient: normalizes failure semantics for OAuth refresh HTTP calls across all providers. Takes a Platform enum so typos fail at compile time and the user-facing label comes from one source. - ConnectionVerifier: all 8 refresh*Token methods route through the new client. Hardcoded OAuth URLs (LinkedIn, YouTube) and Bluesky's default PDS host moved into config/trypost.php alongside the existing per-platform entries. - RefreshSocialToken job: PlatformUnavailableException → log warning and stop. Do NOT markAsTokenExpired, do NOT notify the user. Next scheduled tick retries. - VerifyWorkspaceConnections job: PlatformUnavailableException from the inner refresh propagates and is treated as a transient skip.
23 lines
627 B
PHP
23 lines
627 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Exceptions;
|
|
|
|
use Exception;
|
|
|
|
/**
|
|
* Raised when a social platform's API is unreachable or returning a server
|
|
* error during a token verify/refresh. Distinct from TokenExpiredException
|
|
* because the account's token is not provably invalid — the platform is
|
|
* just down. Callers should retry later instead of disconnecting the user.
|
|
*/
|
|
class PlatformUnavailableException extends Exception
|
|
{
|
|
public function __construct(
|
|
string $message = 'Platform API is unavailable',
|
|
public ?int $httpStatus = null,
|
|
) {
|
|
parent::__construct($message);
|
|
}
|
|
}
|