. */ declare(strict_types=1); namespace App\Exceptions; use Throwable; class OAuthReconnectRequiredException extends \RuntimeException { private string $providerName = "unknown"; public function __construct(string $message = "You need to reconnect the OAuth connection for this provider!", int $code = 0, ?Throwable $previous = null) { parent::__construct($message, $code, $previous); } public static function forProvider(string $providerName): self { $exception = new self("You need to reconnect the OAuth connection for the provider '$providerName'!"); $exception->providerName = $providerName; return $exception; } public function getProviderName(): string { return $this->providerName; } }