From 3472728f3a2b625b1ab2ea1b4aff8e012ec502a9 Mon Sep 17 00:00:00 2001 From: netkas Date: Mon, 3 Feb 2025 13:41:48 -0500 Subject: [PATCH] Added missing method --- src/Socialbox/Exceptions/RequestException.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Socialbox/Exceptions/RequestException.php b/src/Socialbox/Exceptions/RequestException.php index 8d09517..488dc20 100644 --- a/src/Socialbox/Exceptions/RequestException.php +++ b/src/Socialbox/Exceptions/RequestException.php @@ -3,6 +3,7 @@ namespace Socialbox\Exceptions; use Exception; + use Socialbox\Enums\StandardError; use Throwable; class RequestException extends Exception @@ -18,4 +19,14 @@ { parent::__construct($message, $code, $previous); } + + /** + * Gets the standard error associated with the exception code. + * + * @return StandardError The standard error associated with the exception code. + */ + public function getStandardError(): StandardError + { + return StandardError::tryFrom($this->getCode()) ?? StandardError::UNKNOWN; + } } \ No newline at end of file