diff --git a/src/Socialbox/Exceptions/StandardException.php b/src/Socialbox/Exceptions/StandardException.php index 282020b..c163c82 100644 --- a/src/Socialbox/Exceptions/StandardException.php +++ b/src/Socialbox/Exceptions/StandardException.php @@ -4,6 +4,8 @@ namespace Socialbox\Exceptions; use Exception; use Socialbox\Enums\StandardError; +use Socialbox\Objects\RpcError; +use Socialbox\Objects\RpcRequest; use Throwable; class StandardException extends Exception @@ -24,4 +26,9 @@ class StandardException extends Exception { return StandardError::from($this->code); } + + public function produceError(RpcRequest $request): ?RpcError + { + return $request->produceError(StandardError::from($this->code), $this->message); + } } \ No newline at end of file