TenantAtlas/apps/platform/app/Services/Providers/ProviderConfigurationRequiredException.php
Ahmed Darrazi 1123b122d9
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 7m13s
feat: cut over tenant core to managed environments
2026-05-07 08:35:42 +02:00

31 lines
988 B
PHP

<?php
namespace App\Services\Providers;
use App\Models\ManagedEnvironment;
use RuntimeException;
final class ProviderConfigurationRequiredException extends RuntimeException
{
public function __construct(
public readonly int $tenantId,
public readonly string $provider,
public readonly string $reasonCode,
public readonly ?string $extensionReasonCode = null,
string $message = 'Provider configuration is required.',
) {
parent::__construct($message);
}
public static function forTenant(ManagedEnvironment $tenant, string $provider, ProviderConnectionResolution $resolution): self
{
return new self(
tenantId: (int) $tenant->getKey(),
provider: $provider,
reasonCode: $resolution->effectiveReasonCode(),
extensionReasonCode: $resolution->extensionReasonCode,
message: $resolution->message ?? 'Provider configuration is required.',
);
}
}