refactor: rename functions (#4655)

returnClientError => throwClientException
returnServerError => throwServerException

New convenience function: throwRateLimitException

Old functions are kept but deprecated.
This commit is contained in:
Dag 2025-08-05 20:44:40 +02:00 committed by GitHub
parent b39964cee3
commit f11571ae78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
90 changed files with 279 additions and 255 deletions

View file

@ -242,12 +242,33 @@ function create_random_string(int $bytes = 16): string
return bin2hex(openssl_random_pseudo_bytes($bytes));
}
function returnClientError($message)
function throwClientException(string $message = '')
{
throw new \Exception($message, 400);
}
function returnServerError($message)
function throwServerException(string $message = '')
{
throw new \Exception($message, 500);
}
function throwRateLimitException(string $message = '')
{
throw new RateLimitException($message);
}
/**
* @deprecated Use throwClientException() instead
*/
function returnClientError(string $message = '')
{
throw new \Exception($message);
}
/**
* @deprecated Use throwServerException() instead
*/
function returnServerError(string $message = '')
{
throw new \Exception($message);
}