Skip to content

Commit 720f274

Browse files
committed
use DomainNotFoundException
1 parent 6375cbf commit 720f274

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/Domains/Registrar/Adapter/NameCom.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Utopia\Domains\Registrar\Exception\InvalidContactException;
1212
use Utopia\Domains\Registrar\Exception\AuthException;
1313
use Utopia\Domains\Registrar\Exception\PriceNotFoundException;
14-
use Utopia\Domains\Registrar\Exception\DomainNotAvailableException;
14+
use Utopia\Domains\Registrar\Exception\DomainNotFoundException;
1515
use Utopia\Domains\Registrar\Adapter;
1616
use Utopia\Domains\Registrar\Renewal;
1717
use Utopia\Domains\Registrar\TransferStatus;
@@ -334,9 +334,9 @@ public function getPrice(string $domain, int $periodYears = 1, string $regType =
334334
try {
335335
$isAvailable = $this->available($domain);
336336
if (!$isAvailable) {
337-
throw new DomainNotAvailableException('Domain is not available: ' . $domain, 400);
337+
throw new DomainNotFoundException('Domain is not available: ' . $domain, 400);
338338
}
339-
} catch (DomainNotAvailableException $e) {
339+
} catch (DomainNotFoundException $e) {
340340
throw $e;
341341
} catch (Exception $e) {
342342
throw new DomainsException('Failed to get price for domain: ' . $e->getMessage(), $e->getCode(), $e);
@@ -527,7 +527,6 @@ public function getAuthCode(string $domain): string
527527
public function checkTransferStatus(string $domain): TransferStatus
528528
{
529529
try {
530-
// Use efficient single-domain lookup endpoint
531530
$result = $this->send('GET', '/core/v1/transfers/' . $domain);
532531

533532
$status = $this->mapTransferStatus($result['status'] ?? 'unknown');
@@ -539,13 +538,8 @@ public function checkTransferStatus(string $domain): TransferStatus
539538
timestamp: isset($result['created']) ? new DateTime($result['created']) : null,
540539
);
541540
} catch (Exception $e) {
542-
// If transfer not found (404), domain is transferable (no transfer initiated)
543541
if ($e->getCode() === 404) {
544-
return new TransferStatus(
545-
status: TransferStatusEnum::Transferrable,
546-
reason: null,
547-
timestamp: null,
548-
);
542+
throw new DomainNotFoundException('Domain not found: ' . $domain, $e->getCode(), $e);
549543
}
550544

551545
throw new DomainsException('Failed to check transfer status: ' . $e->getMessage(), $e->getCode(), $e);

src/Domains/Registrar/Exception/DomainNotAvailableException.php renamed to src/Domains/Registrar/Exception/DomainNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
use Utopia\Domains\Exception;
66

7-
class DomainNotAvailableException extends Exception
7+
class DomainNotFoundException extends Exception
88
{
99
}

0 commit comments

Comments
 (0)