Skip to content

Commit

Permalink
chore: refactor to simple exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ju5t committed Jun 3, 2024
1 parent e5597df commit 31ae8e1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/Exceptions/AuthenticationFailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
}
6 changes: 3 additions & 3 deletions src/Exceptions/CommandNotFound.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
}
6 changes: 3 additions & 3 deletions src/Exceptions/ConnectionFailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
6 changes: 3 additions & 3 deletions src/Exceptions/InvalidResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
6 changes: 3 additions & 3 deletions src/Exceptions/Unauthorized.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
}

0 comments on commit 31ae8e1

Please sign in to comment.