Merge pull request 'FIX: ServiceActions' (#21) from hotfix/exceptions into develop

Reviewed-on: #21
This commit is contained in:
2025-03-04 16:52:44 +00:00
5 changed files with 75 additions and 0 deletions

View File

@ -0,0 +1,15 @@
<?php
namespace Incoviba\Exception\ServiceAction;
use Throwable;
use Incoviba\Exception\ServiceActionFail;
class Create extends ServiceActionFail
{
public function __construct(string $service, Throwable $previous = null)
{
$action = 'create';
$code = 1;
parent::__construct($service, $action, $code, $previous);
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace Incoviba\Exception\ServiceAction;
use Throwable;
use Incoviba\Exception\ServiceActionFail;
class Delete extends ServiceActionFail
{
public function __construct(string $service, Throwable $previous = null)
{
$action = 'delete';
$code = 4;
parent::__construct($service, $action, $code, $previous);
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace Incoviba\Exception\ServiceAction;
use Throwable;
use Incoviba\Exception\ServiceActionFail;
class Read extends ServiceActionFail
{
public function __construct(string $service, Throwable $previous = null)
{
$action = 'read';
$code = 2;
parent::__construct($service, $action, $code, $previous);
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace Incoviba\Exception\ServiceAction;
use Throwable;
use Incoviba\Exception\ServiceActionFail;
class Update extends ServiceActionFail
{
public function __construct(string $service, Throwable $previous = null)
{
$action = 'edit';
$code = 3;
parent::__construct($service, $action, $code, $previous);
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace Incoviba\Exception;
use Exception;
use Throwable;
class ServiceActionFail extends Exception
{
public function __construct(string $service,string $action = "__invoke", int $code = 0, Throwable $previous = null)
{
$message = "Action {$action} failed for Service {$service}.";
$code = 700 + $code;
parent::__construct($message, $code, $previous);
}
}