diff --git a/src/Socialbox/Classes/StandardMethods/Core/GetSessionState.php b/src/Socialbox/Classes/StandardMethods/Core/GetSessionState.php index b2ed25f..ec52024 100644 --- a/src/Socialbox/Classes/StandardMethods/Core/GetSessionState.php +++ b/src/Socialbox/Classes/StandardMethods/Core/GetSessionState.php @@ -3,6 +3,9 @@ namespace Socialbox\Classes\StandardMethods\Core; use Socialbox\Abstracts\Method; + use Socialbox\Enums\StandardError; + use Socialbox\Exceptions\DatabaseOperationException; + use Socialbox\Exceptions\Standard\StandardRpcException; use Socialbox\Interfaces\SerializableInterface; use Socialbox\Objects\ClientRequest; use Socialbox\Objects\RpcRequest; @@ -14,6 +17,13 @@ */ public static function execute(ClientRequest $request, RpcRequest $rpcRequest): ?SerializableInterface { - return $rpcRequest->produceResponse($request->getSession()->toStandardSessionState()); + try + { + return $rpcRequest->produceResponse($request->getSession()->toStandardSessionState()); + } + catch (DatabaseOperationException $e) + { + throw new StandardRpcException('Failed to retrieve session state due to an internal exception', StandardError::INTERNAL_SERVER_ERROR, $e); + } } } \ No newline at end of file