From d8fe574437e48f2f2dcd3b924d002ac0e104dd16 Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 31 Jan 2025 15:33:05 -0500 Subject: [PATCH] Improved exception handling --- .../StandardMethods/Settings/SettingsAddSignature.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Socialbox/Classes/StandardMethods/Settings/SettingsAddSignature.php b/src/Socialbox/Classes/StandardMethods/Settings/SettingsAddSignature.php index 5b3de2a..fba4d44 100644 --- a/src/Socialbox/Classes/StandardMethods/Settings/SettingsAddSignature.php +++ b/src/Socialbox/Classes/StandardMethods/Settings/SettingsAddSignature.php @@ -7,6 +7,8 @@ use Socialbox\Abstracts\Method; use Socialbox\Classes\Configuration; use Socialbox\Enums\StandardError; + use Socialbox\Exceptions\DatabaseOperationException; + use Socialbox\Exceptions\Standard\InvalidRpcArgumentException; use Socialbox\Exceptions\Standard\MissingRpcArgumentException; use Socialbox\Exceptions\Standard\StandardRpcException; use Socialbox\Interfaces\SerializableInterface; @@ -54,9 +56,9 @@ } catch(InvalidArgumentException $e) { - return $rpcRequest->produceError(StandardError::RPC_INVALID_ARGUMENTS, $e->getMessage()); + throw new InvalidRpcArgumentException($e); } - catch(Exception $e) + catch(DatabaseOperationException $e) { throw new StandardRpcException('Failed to add the signing key', StandardError::INTERNAL_SERVER_ERROR, $e); }