aboutsummaryrefslogtreecommitdiff
path: root/includes/vendor/maxmind/web-service-common/src/Exception
diff options
context:
space:
mode:
Diffstat (limited to 'includes/vendor/maxmind/web-service-common/src/Exception')
-rw-r--r--includes/vendor/maxmind/web-service-common/src/Exception/AuthenticationException.php10
-rw-r--r--includes/vendor/maxmind/web-service-common/src/Exception/HttpException.php40
-rw-r--r--includes/vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php10
-rw-r--r--includes/vendor/maxmind/web-service-common/src/Exception/InvalidInputException.php12
-rw-r--r--includes/vendor/maxmind/web-service-common/src/Exception/InvalidRequestException.php37
-rw-r--r--includes/vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php7
-rw-r--r--includes/vendor/maxmind/web-service-common/src/Exception/PermissionRequiredException.php10
-rw-r--r--includes/vendor/maxmind/web-service-common/src/Exception/WebServiceException.php10
8 files changed, 136 insertions, 0 deletions
diff --git a/includes/vendor/maxmind/web-service-common/src/Exception/AuthenticationException.php b/includes/vendor/maxmind/web-service-common/src/Exception/AuthenticationException.php
new file mode 100644
index 0000000..ba42362
--- /dev/null
+++ b/includes/vendor/maxmind/web-service-common/src/Exception/AuthenticationException.php
@@ -0,0 +1,10 @@
+<?php
+
+namespace MaxMind\Exception;
+
+/**
+ * This class represents an error authenticating.
+ */
+class AuthenticationException extends InvalidRequestException
+{
+}
diff --git a/includes/vendor/maxmind/web-service-common/src/Exception/HttpException.php b/includes/vendor/maxmind/web-service-common/src/Exception/HttpException.php
new file mode 100644
index 0000000..f158944
--- /dev/null
+++ b/includes/vendor/maxmind/web-service-common/src/Exception/HttpException.php
@@ -0,0 +1,40 @@
+<?php
+
+namespace MaxMind\Exception;
+
+/**
+ * This class represents an HTTP transport error.
+ */
+class HttpException extends WebServiceException
+{
+ /**
+ * The URI queried.
+ */
+ private $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 \Exception $previous the previous exception, if any
+ */
+ public function __construct(
+ $message,
+ $httpStatus,
+ $uri,
+ \Exception $previous = null
+ ) {
+ $this->uri = $uri;
+ parent::__construct($message, $httpStatus, $previous);
+ }
+
+ public function getUri()
+ {
+ return $this->uri;
+ }
+
+ public function getStatusCode()
+ {
+ return $this->getCode();
+ }
+}
diff --git a/includes/vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php b/includes/vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php
new file mode 100644
index 0000000..fe159a2
--- /dev/null
+++ b/includes/vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php
@@ -0,0 +1,10 @@
+<?php
+
+namespace MaxMind\Exception;
+
+/**
+ * Thrown when the account is out of credits.
+ */
+class InsufficientFundsException extends InvalidRequestException
+{
+}
diff --git a/includes/vendor/maxmind/web-service-common/src/Exception/InvalidInputException.php b/includes/vendor/maxmind/web-service-common/src/Exception/InvalidInputException.php
new file mode 100644
index 0000000..3a6b32a
--- /dev/null
+++ b/includes/vendor/maxmind/web-service-common/src/Exception/InvalidInputException.php
@@ -0,0 +1,12 @@
+<?php
+
+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
+{
+}
diff --git a/includes/vendor/maxmind/web-service-common/src/Exception/InvalidRequestException.php b/includes/vendor/maxmind/web-service-common/src/Exception/InvalidRequestException.php
new file mode 100644
index 0000000..354f4b6
--- /dev/null
+++ b/includes/vendor/maxmind/web-service-common/src/Exception/InvalidRequestException.php
@@ -0,0 +1,37 @@
+<?php
+
+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 $error;
+
+ /**
+ * @param string $message the exception message
+ * @param int $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 \Exception $previous the previous exception, if any
+ */
+ public function __construct(
+ $message,
+ $error,
+ $httpStatus,
+ $uri,
+ \Exception $previous = null
+ ) {
+ $this->error = $error;
+ parent::__construct($message, $httpStatus, $uri, $previous);
+ }
+
+ public function getErrorCode()
+ {
+ return $this->error;
+ }
+}
diff --git a/includes/vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php b/includes/vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php
new file mode 100644
index 0000000..31608f7
--- /dev/null
+++ b/includes/vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php
@@ -0,0 +1,7 @@
+<?php
+
+namespace MaxMind\Exception;
+
+class IpAddressNotFoundException extends InvalidRequestException
+{
+}
diff --git a/includes/vendor/maxmind/web-service-common/src/Exception/PermissionRequiredException.php b/includes/vendor/maxmind/web-service-common/src/Exception/PermissionRequiredException.php
new file mode 100644
index 0000000..5f87854
--- /dev/null
+++ b/includes/vendor/maxmind/web-service-common/src/Exception/PermissionRequiredException.php
@@ -0,0 +1,10 @@
+<?php
+
+namespace MaxMind\Exception;
+
+/**
+ * This exception is thrown when the service requires permission to access.
+ */
+class PermissionRequiredException extends InvalidRequestException
+{
+}
diff --git a/includes/vendor/maxmind/web-service-common/src/Exception/WebServiceException.php b/includes/vendor/maxmind/web-service-common/src/Exception/WebServiceException.php
new file mode 100644
index 0000000..ff33452
--- /dev/null
+++ b/includes/vendor/maxmind/web-service-common/src/Exception/WebServiceException.php
@@ -0,0 +1,10 @@
+<?php
+
+namespace MaxMind\Exception;
+
+/**
+ * This class represents a generic web service error.
+ */
+class WebServiceException extends \Exception
+{
+}