mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
refactor: change log level and add exceptions
This commit is contained in:
@@ -4,8 +4,8 @@ namespace App\Exception;
|
||||
|
||||
class DomainNotFoundException extends \Exception
|
||||
{
|
||||
public static function fromDomain(string $ldhName): DomainNotFoundException
|
||||
public static function fromDomain(string $ldhName): self
|
||||
{
|
||||
return new DomainNotFoundException("The domain name $ldhName is not present in the WHOIS database");
|
||||
return new self("The domain name $ldhName is not present in the WHOIS database");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ namespace App\Exception;
|
||||
|
||||
class MalformedDomainException extends \Exception
|
||||
{
|
||||
public static function fromDomain(string $ldhName): MalformedDomainException
|
||||
public static function fromDomain(string $ldhName): self
|
||||
{
|
||||
return new MalformedDomainException("Domain name ($ldhName) must contain at least one dot");
|
||||
return new self("Domain name ($ldhName) must contain at least one dot");
|
||||
}
|
||||
}
|
||||
|
||||
7
src/Exception/Provider/AbstractProviderException.php
Normal file
7
src/Exception/Provider/AbstractProviderException.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exception\Provider;
|
||||
|
||||
abstract class AbstractProviderException extends \Exception
|
||||
{
|
||||
}
|
||||
7
src/Exception/Provider/DomainOrderFailedExeption.php
Normal file
7
src/Exception/Provider/DomainOrderFailedExeption.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exception\Provider;
|
||||
|
||||
class DomainOrderFailedExeption extends AbstractProviderException
|
||||
{
|
||||
}
|
||||
11
src/Exception/Provider/EppContactIsAvailableException.php
Normal file
11
src/Exception/Provider/EppContactIsAvailableException.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exception\Provider;
|
||||
|
||||
class EppContactIsAvailableException extends AbstractProviderException
|
||||
{
|
||||
public static function fromContact(string $handle): self
|
||||
{
|
||||
return new self("At least one of the entered contacts cannot be used because it is indicated as available ($handle)");
|
||||
}
|
||||
}
|
||||
11
src/Exception/Provider/ExpiredLoginException.php
Normal file
11
src/Exception/Provider/ExpiredLoginException.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exception\Provider;
|
||||
|
||||
class ExpiredLoginException extends AbstractProviderException
|
||||
{
|
||||
public static function fromIdentifier(string $identifier): self
|
||||
{
|
||||
return new self("Expired login for identifier $identifier");
|
||||
}
|
||||
}
|
||||
16
src/Exception/Provider/InvalidLoginException.php
Normal file
16
src/Exception/Provider/InvalidLoginException.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exception\Provider;
|
||||
|
||||
class InvalidLoginException extends AbstractProviderException
|
||||
{
|
||||
public function __construct(string $message = '')
|
||||
{
|
||||
parent::__construct('' === $message ? 'The status of these credentials is not valid' : $message);
|
||||
}
|
||||
|
||||
public static function fromIdentifier(string $identifier): self
|
||||
{
|
||||
return new self("Invalid login for identifier $identifier");
|
||||
}
|
||||
}
|
||||
11
src/Exception/Provider/InvalidLoginStatusException.php
Normal file
11
src/Exception/Provider/InvalidLoginStatusException.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exception\Provider;
|
||||
|
||||
class InvalidLoginStatusException extends AbstractProviderException
|
||||
{
|
||||
public static function fromStatus(string $status): self
|
||||
{
|
||||
return new self("The status of these credentials is not valid ($status)");
|
||||
}
|
||||
}
|
||||
11
src/Exception/Provider/NamecheapRequiresAddressException.php
Normal file
11
src/Exception/Provider/NamecheapRequiresAddressException.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exception\Provider;
|
||||
|
||||
class NamecheapRequiresAddressException extends AbstractProviderException
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('Namecheap account requires at least one address to purchase a domain');
|
||||
}
|
||||
}
|
||||
11
src/Exception/Provider/PermissionErrorException.php
Normal file
11
src/Exception/Provider/PermissionErrorException.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exception\Provider;
|
||||
|
||||
class PermissionErrorException extends AbstractProviderException
|
||||
{
|
||||
public static function fromIdentifier(string $identifier): self
|
||||
{
|
||||
return new self("Not enough permissions for identifier $identifier");
|
||||
}
|
||||
}
|
||||
11
src/Exception/Provider/ProviderGenericErrorException.php
Normal file
11
src/Exception/Provider/ProviderGenericErrorException.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exception\Provider;
|
||||
|
||||
class ProviderGenericErrorException extends AbstractProviderException
|
||||
{
|
||||
public function __construct(string $message)
|
||||
{
|
||||
parent::__construct($message);
|
||||
}
|
||||
}
|
||||
11
src/Exception/Provider/UserNoExplicitConsentException.php
Normal file
11
src/Exception/Provider/UserNoExplicitConsentException.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exception\Provider;
|
||||
|
||||
class UserNoExplicitConsentException extends AbstractProviderException
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('The user has not given explicit consent');
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@ namespace App\Exception;
|
||||
|
||||
class TldNotSupportedException extends \Exception
|
||||
{
|
||||
public static function fromTld(string $tld): TldNotSupportedException
|
||||
public static function fromTld(string $tld): self
|
||||
{
|
||||
return new TldNotSupportedException("The requested TLD $tld is not yet supported, please try again with another one");
|
||||
return new self("The requested TLD $tld is not yet supported, please try again with another one");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ namespace App\Exception;
|
||||
|
||||
class UnknownRdapServerException extends \Exception
|
||||
{
|
||||
public static function fromTld(string $tld): UnknownRdapServerException
|
||||
public static function fromTld(string $tld): self
|
||||
{
|
||||
return new UnknownRdapServerException("TLD $tld: Unable to determine which RDAP server to contact");
|
||||
return new self("TLD $tld: Unable to determine which RDAP server to contact");
|
||||
}
|
||||
}
|
||||
|
||||
11
src/Exception/UnsupportedDsnSchemeException.php
Normal file
11
src/Exception/UnsupportedDsnSchemeException.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exception;
|
||||
|
||||
class UnsupportedDsnSchemeException extends \Exception
|
||||
{
|
||||
public static function fromScheme(string $scheme): UnsupportedDsnSchemeException
|
||||
{
|
||||
return new UnsupportedDsnSchemeException("The DSN scheme ($scheme) is not supported");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user