Added InvalidRpcArgumentException which extends StandardException & Renamed MissingArgumentException to MissingRpcArgumentException for clarification and to avoid conflict with existing \InvalidArgumentException (base php)

This commit is contained in:
netkas 2025-01-30 00:30:25 -05:00
parent cffed44f96
commit 8ced492c5b
2 changed files with 21 additions and 2 deletions

View file

@ -0,0 +1,19 @@
<?php
namespace Socialbox\Exceptions\Standard;
use Socialbox\Enums\StandardError;
class InvalidRpcArgumentException extends StandardException
{
/**
* Thrown when a required parameter is missing
*
* @param string $parameterName The name of the parameter that is missing
* @param string $reason The reason why the parameter is invalid
*/
public function __construct(string $parameterName, string $reason)
{
parent::__construct(sprintf('The parameter %s is invalid: %s', $parameterName, $reason), StandardError::RPC_INVALID_ARGUMENTS);
}
}

View file

@ -4,12 +4,12 @@
use Socialbox\Enums\StandardError;
class MissingArgumentException extends StandardException
class MissingRpcArgumentException extends StandardException
{
/**
* Thrown when a required parameter is missing
*
* @param string $parameterName
* @param string $parameterName The name of the missing parameter
*/
public function __construct(string $parameterName)
{