Added missing method

This commit is contained in:
netkas 2025-02-03 13:41:48 -05:00
parent f74a91963e
commit 3472728f3a

View file

@ -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;
}
}