Renamed StandardException to StandardRpcException

This commit is contained in:
netkas 2025-01-30 00:37:37 -05:00
parent 4856dacb9d
commit b8346e139c
38 changed files with 129 additions and 129 deletions

View file

@ -6,7 +6,7 @@
use Socialbox\Enums\StandardError;
use Socialbox\Enums\StandardMethods;
use Socialbox\Exceptions\DatabaseOperationException;
use Socialbox\Exceptions\Standard\StandardException;
use Socialbox\Exceptions\Standard\StandardRpcException;
use Socialbox\Interfaces\SerializableInterface;
use Socialbox\Objects\ClientRequest;
use Socialbox\Objects\RpcRequest;
@ -31,7 +31,7 @@
}
catch(DatabaseOperationException $e)
{
throw new StandardException('Failed to retrieve allowed methods due to an internal exception', StandardError::INTERNAL_SERVER_ERROR, $e);
throw new StandardRpcException('Failed to retrieve allowed methods due to an internal exception', StandardError::INTERNAL_SERVER_ERROR, $e);
}
return $rpcRequest->produceResponse($allowedMethods);

View file

@ -7,7 +7,7 @@
use Socialbox\Abstracts\Method;
use Socialbox\Enums\ReservedUsernames;
use Socialbox\Enums\StandardError;
use Socialbox\Exceptions\Standard\StandardException;
use Socialbox\Exceptions\Standard\StandardRpcException;
use Socialbox\Interfaces\SerializableInterface;
use Socialbox\Objects\ClientRequest;
use Socialbox\Objects\PeerAddress;
@ -35,7 +35,7 @@
}
catch(InvalidArgumentException $e)
{
throw new StandardException('Peer Address Error: ' . $e->getMessage(), StandardError::RPC_INVALID_ARGUMENTS, $e);
throw new StandardRpcException('Peer Address Error: ' . $e->getMessage(), StandardError::RPC_INVALID_ARGUMENTS, $e);
}
// Check if host is making the request & the identifier is not empty
@ -52,7 +52,7 @@
}
catch(Exception $e)
{
throw new StandardException(sprintf('There was an error while trying to resolve the peer %s: %s', $peerAddress, $e->getMessage()), StandardError::RESOLUTION_FAILED, $e);
throw new StandardRpcException(sprintf('There was an error while trying to resolve the peer %s: %s', $peerAddress, $e->getMessage()), StandardError::RESOLUTION_FAILED, $e);
}
}
}

View file

@ -6,7 +6,7 @@
use InvalidArgumentException;
use Socialbox\Abstracts\Method;
use Socialbox\Enums\StandardError;
use Socialbox\Exceptions\Standard\StandardException;
use Socialbox\Exceptions\Standard\StandardRpcException;
use Socialbox\Interfaces\SerializableInterface;
use Socialbox\Objects\ClientRequest;
use Socialbox\Objects\PeerAddress;
@ -39,7 +39,7 @@
}
catch(InvalidArgumentException $e)
{
throw new StandardException('Invalid UUID', StandardError::RPC_INVALID_ARGUMENTS, $e);
throw new StandardRpcException('Invalid UUID', StandardError::RPC_INVALID_ARGUMENTS, $e);
}
// Parse the peer address
@ -49,20 +49,20 @@
}
catch(InvalidArgumentException $e)
{
throw new StandardException('Peer Address Error: ' . $e->getMessage(), StandardError::RPC_INVALID_ARGUMENTS, $e);
throw new StandardRpcException('Peer Address Error: ' . $e->getMessage(), StandardError::RPC_INVALID_ARGUMENTS, $e);
}
try
{
return $rpcRequest->produceResponse(Socialbox::resolvePeerSignature($peerAddress, $uuid->toRfc4122()));
}
catch(StandardException $e)
catch(StandardRpcException $e)
{
throw $e;
}
catch (Exception $e)
{
throw new StandardException('Failed to resolve peer signature', StandardError::INTERNAL_SERVER_ERROR, $e);
throw new StandardRpcException('Failed to resolve peer signature', StandardError::INTERNAL_SERVER_ERROR, $e);
}
}
}