前端分流页功能
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MaxMind\Exception;
|
||||
|
||||
/**
|
||||
* This class represents an error authenticating.
|
||||
*/
|
||||
class AuthenticationException extends InvalidRequestException
|
||||
{
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MaxMind\Exception;
|
||||
|
||||
/**
|
||||
* This class represents an HTTP transport error.
|
||||
*/
|
||||
class HttpException extends WebServiceException
|
||||
{
|
||||
/**
|
||||
* The URI queried.
|
||||
*/
|
||||
private readonly string $uri;
|
||||
|
||||
/**
|
||||
* @param string $message a message describing the error
|
||||
* @param int $httpStatus the HTTP status code of the response
|
||||
* @param string $uri the URI used in the request
|
||||
* @param \Throwable $previous the previous exception, if any
|
||||
*/
|
||||
public function __construct(
|
||||
string $message,
|
||||
int $httpStatus,
|
||||
string $uri,
|
||||
?\Throwable $previous = null
|
||||
) {
|
||||
$this->uri = $uri;
|
||||
parent::__construct($message, $httpStatus, $previous);
|
||||
}
|
||||
|
||||
public function getUri(): string
|
||||
{
|
||||
return $this->uri;
|
||||
}
|
||||
|
||||
public function getStatusCode(): int
|
||||
{
|
||||
return $this->getCode();
|
||||
}
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MaxMind\Exception;
|
||||
|
||||
/**
|
||||
* Thrown when the account is out of credits.
|
||||
*/
|
||||
class InsufficientFundsException extends InvalidRequestException
|
||||
{
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MaxMind\Exception;
|
||||
|
||||
/**
|
||||
* This class represents an error in creating the request to be sent to the
|
||||
* web service. For example, if the array cannot be encoded as JSON or if there
|
||||
* is a missing or invalid field.
|
||||
*/
|
||||
class InvalidInputException extends WebServiceException
|
||||
{
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MaxMind\Exception;
|
||||
|
||||
/**
|
||||
* Thrown when a MaxMind web service returns an error relating to the request.
|
||||
*/
|
||||
class InvalidRequestException extends HttpException
|
||||
{
|
||||
/**
|
||||
* The code returned by the MaxMind web service.
|
||||
*/
|
||||
private readonly string $error;
|
||||
|
||||
/**
|
||||
* @param string $message the exception message
|
||||
* @param string $error the error code returned by the MaxMind web service
|
||||
* @param int $httpStatus the HTTP status code of the response
|
||||
* @param string $uri the URI queries
|
||||
* @param \Throwable $previous the previous exception, if any
|
||||
*/
|
||||
public function __construct(
|
||||
string $message,
|
||||
string $error,
|
||||
int $httpStatus,
|
||||
string $uri,
|
||||
?\Throwable $previous = null
|
||||
) {
|
||||
$this->error = $error;
|
||||
parent::__construct($message, $httpStatus, $uri, $previous);
|
||||
}
|
||||
|
||||
public function getErrorCode(): string
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MaxMind\Exception;
|
||||
|
||||
/**
|
||||
* Thrown when the IP address is not found in the database.
|
||||
*/
|
||||
class IpAddressNotFoundException extends InvalidRequestException
|
||||
{
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MaxMind\Exception;
|
||||
|
||||
/**
|
||||
* This exception is thrown when the service requires permission to access.
|
||||
*/
|
||||
class PermissionRequiredException extends InvalidRequestException
|
||||
{
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MaxMind\Exception;
|
||||
|
||||
/**
|
||||
* This class represents a generic web service error.
|
||||
*/
|
||||
class WebServiceException extends \Exception
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user