summaryrefslogtreecommitdiffstats
path: root/vendor/maxmind/web-service-common/src/Exception
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-01-11 12:35:47 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2022-01-11 12:35:47 +0100
commit19985dbb8c0aa66dc4bf7905abc1148de909097d (patch)
tree2cd5a5d20d7e80fc2a51adf60d838d8a2c40999e /vendor/maxmind/web-service-common/src/Exception
download1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.gz
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.bz2
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.lz
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.xz
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.zst
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.zip
Diffstat (limited to 'vendor/maxmind/web-service-common/src/Exception')
-rw-r--r--vendor/maxmind/web-service-common/src/Exception/AuthenticationException.php10
-rw-r--r--vendor/maxmind/web-service-common/src/Exception/HttpException.php40
-rw-r--r--vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php10
-rw-r--r--vendor/maxmind/web-service-common/src/Exception/InvalidInputException.php12
-rw-r--r--vendor/maxmind/web-service-common/src/Exception/InvalidRequestException.php37
-rw-r--r--vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php7
-rw-r--r--vendor/maxmind/web-service-common/src/Exception/PermissionRequiredException.php10
-rw-r--r--vendor/maxmind/web-service-common/src/Exception/WebServiceException.php10
8 files changed, 136 insertions, 0 deletions
diff --git a/vendor/maxmind/web-service-common/src/Exception/AuthenticationException.php b/vendor/maxmind/web-service-common/src/Exception/AuthenticationException.php
new file mode 100644
index 0000000..54258ca
--- /dev/null
+++ b/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/vendor/maxmind/web-service-common/src/Exception/HttpException.php b/vendor/maxmind/web-service-common/src/Exception/HttpException.php
new file mode 100644
index 0000000..990ee79
--- /dev/null
+++ b/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/vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php b/vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php
new file mode 100644
index 0000000..4d6b3be
--- /dev/null
+++ b/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/vendor/maxmind/web-service-common/src/Exception/InvalidInputException.php b/vendor/maxmind/web-service-common/src/Exception/InvalidInputException.php
new file mode 100644
index 0000000..091829a
--- /dev/null
+++ b/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/vendor/maxmind/web-service-common/src/Exception/InvalidRequestException.php b/vendor/maxmind/web-service-common/src/Exception/InvalidRequestException.php
new file mode 100644
index 0000000..c9168ef
--- /dev/null
+++ b/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/vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php b/vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php
new file mode 100644
index 0000000..1a743a1
--- /dev/null
+++ b/vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php
@@ -0,0 +1,7 @@
+<?php
+
+namespace MaxMind\Exception;
+
+class IpAddressNotFoundException extends InvalidRequestException
+{
+}
diff --git a/vendor/maxmind/web-service-common/src/Exception/PermissionRequiredException.php b/vendor/maxmind/web-service-common/src/Exception/PermissionRequiredException.php
new file mode 100644
index 0000000..48c7a66
--- /dev/null
+++ b/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/vendor/maxmind/web-service-common/src/Exception/WebServiceException.php b/vendor/maxmind/web-service-common/src/Exception/WebServiceException.php
new file mode 100644
index 0000000..e227810
--- /dev/null
+++ b/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
+{
+}