From 31ae8e196f440fd0cf0ddd6c98e58492be640107 Mon Sep 17 00:00:00 2001 From: ju5t Date: Mon, 3 Jun 2024 11:12:07 +0200 Subject: [PATCH] chore: refactor to simple exceptions --- src/Exceptions/AuthenticationFailed.php | 6 +++--- src/Exceptions/CommandNotFound.php | 6 +++--- src/Exceptions/ConnectionFailed.php | 6 +++--- src/Exceptions/InvalidResponse.php | 6 +++--- src/Exceptions/Unauthorized.php | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Exceptions/AuthenticationFailed.php b/src/Exceptions/AuthenticationFailed.php index b98aca5..34aae47 100644 --- a/src/Exceptions/AuthenticationFailed.php +++ b/src/Exceptions/AuthenticationFailed.php @@ -2,12 +2,12 @@ namespace Sensson\DirectAdmin\Exceptions; -use Symfony\Component\HttpKernel\Exception\HttpException; +use Exception; -class AuthenticationFailed extends HttpException +class AuthenticationFailed extends Exception { public static function create(): self { - return new self(401, 'Unauthorized. Please check the credentials.'); + return new self('Unauthorized. Please check the credentials.'); } } diff --git a/src/Exceptions/CommandNotFound.php b/src/Exceptions/CommandNotFound.php index c0c2850..b016ac7 100644 --- a/src/Exceptions/CommandNotFound.php +++ b/src/Exceptions/CommandNotFound.php @@ -2,12 +2,12 @@ namespace Sensson\DirectAdmin\Exceptions; -use Symfony\Component\HttpKernel\Exception\HttpException; +use Exception; -class CommandNotFound extends HttpException +class CommandNotFound extends Exception { public static function create(string $command): self { - return new self(405, 'Command `'.$command.'` does not exist.'); + return new self('Command `'.$command.'` does not exist.'); } } diff --git a/src/Exceptions/ConnectionFailed.php b/src/Exceptions/ConnectionFailed.php index b178b47..0f0c604 100644 --- a/src/Exceptions/ConnectionFailed.php +++ b/src/Exceptions/ConnectionFailed.php @@ -2,12 +2,12 @@ namespace Sensson\DirectAdmin\Exceptions; -use Symfony\Component\HttpKernel\Exception\HttpException; +use Exception; -class ConnectionFailed extends HttpException +class ConnectionFailed extends Exception { public static function create(string $message): self { - return new self(500, $message); + return new self($message); } } diff --git a/src/Exceptions/InvalidResponse.php b/src/Exceptions/InvalidResponse.php index 2d78468..728ca81 100644 --- a/src/Exceptions/InvalidResponse.php +++ b/src/Exceptions/InvalidResponse.php @@ -2,12 +2,12 @@ namespace Sensson\DirectAdmin\Exceptions; -use Symfony\Component\HttpKernel\Exception\HttpException; +use Exception; -class InvalidResponse extends HttpException +class InvalidResponse extends Exception { public static function create(string $message): self { - return new self(500, $message); + return new self($message); } } diff --git a/src/Exceptions/Unauthorized.php b/src/Exceptions/Unauthorized.php index f4b7547..8653004 100644 --- a/src/Exceptions/Unauthorized.php +++ b/src/Exceptions/Unauthorized.php @@ -2,12 +2,12 @@ namespace Sensson\DirectAdmin\Exceptions; -use Symfony\Component\HttpKernel\Exception\HttpException; +use Exception; -class Unauthorized extends HttpException +class Unauthorized extends Exception { public static function create(): self { - return new self(403, 'You do not have access to this resource.'); + return new self('You do not have access to this resource.'); } }