summaryrefslogtreecommitdiff
path: root/vendor/thecodingmachine/safe/lib/Exceptions
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/thecodingmachine/safe/lib/Exceptions')
-rw-r--r--vendor/thecodingmachine/safe/lib/Exceptions/CurlException.php4
-rw-r--r--vendor/thecodingmachine/safe/lib/Exceptions/JsonException.php2
-rw-r--r--vendor/thecodingmachine/safe/lib/Exceptions/SimplexmlException.php11
3 files changed, 14 insertions, 3 deletions
diff --git a/vendor/thecodingmachine/safe/lib/Exceptions/CurlException.php b/vendor/thecodingmachine/safe/lib/Exceptions/CurlException.php
index 2814066b0..d0dbdb695 100644
--- a/vendor/thecodingmachine/safe/lib/Exceptions/CurlException.php
+++ b/vendor/thecodingmachine/safe/lib/Exceptions/CurlException.php
@@ -6,9 +6,9 @@ namespace Safe\Exceptions;
class CurlException extends \Exception implements SafeExceptionInterface
{
/**
- * @param resource $ch
+ * @param \CurlHandle $ch
*/
- public static function createFromCurlResource($ch): self
+ public static function createFromPhpError($ch): self
{
return new self(\curl_error($ch), \curl_errno($ch));
}
diff --git a/vendor/thecodingmachine/safe/lib/Exceptions/JsonException.php b/vendor/thecodingmachine/safe/lib/Exceptions/JsonException.php
index 4300d29e9..d7d5a010d 100644
--- a/vendor/thecodingmachine/safe/lib/Exceptions/JsonException.php
+++ b/vendor/thecodingmachine/safe/lib/Exceptions/JsonException.php
@@ -3,7 +3,7 @@
namespace Safe\Exceptions;
-class JsonException extends \Exception implements SafeExceptionInterface
+class JsonException extends \JsonException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
diff --git a/vendor/thecodingmachine/safe/lib/Exceptions/SimplexmlException.php b/vendor/thecodingmachine/safe/lib/Exceptions/SimplexmlException.php
new file mode 100644
index 000000000..477a9151c
--- /dev/null
+++ b/vendor/thecodingmachine/safe/lib/Exceptions/SimplexmlException.php
@@ -0,0 +1,11 @@
+<?php
+namespace Safe\Exceptions;
+
+class SimplexmlException extends \ErrorException implements SafeExceptionInterface
+{
+ public static function createFromPhpError(): self
+ {
+ $error = \error_get_last();
+ return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
+ }
+}