Rename BaseApi->logErrorAndJsonExit to logAndJsonError to better match the functionality

- Also it's shorter and we're paying by the character
This commit is contained in:
Hypolite Petovan 2023-10-11 09:37:49 -04:00
parent eb583330df
commit 1b9ec3a214
57 changed files with 128 additions and 128 deletions

View file

@ -424,17 +424,17 @@ class BaseApi extends BaseModule
if (empty($token)) {
$this->logger->notice('Empty application token');
$this->logErrorAndJsonExit(403, $this->errorFactory->Forbidden());
$this->logAndJsonError(403, $this->errorFactory->Forbidden());
}
if (!isset($token[$scope])) {
$this->logger->warning('The requested scope does not exist', ['scope' => $scope, 'application' => $token]);
$this->logErrorAndJsonExit(403, $this->errorFactory->Forbidden());
$this->logAndJsonError(403, $this->errorFactory->Forbidden());
}
if (empty($token[$scope])) {
$this->logger->warning('The requested scope is not allowed', ['scope' => $scope, 'application' => $token]);
$this->logErrorAndJsonExit(403, $this->errorFactory->Forbidden());
$this->logAndJsonError(403, $this->errorFactory->Forbidden());
}
}
@ -526,7 +526,7 @@ class BaseApi extends BaseModule
* @return void
* @throws HTTPException\InternalServerErrorException
*/
protected function logErrorAndJsonExit(int $errorno, Error $error)
protected function logAndJsonError(int $errorno, Error $error)
{
$this->logger->info('API Error', ['no' => $errorno, 'error' => $error->toArray(), 'method' => $this->args->getMethod(), 'command' => $this->args->getQueryString(), 'user-agent' => $this->server['HTTP_USER_AGENT'] ?? '']);
$this->jsonError(403, $error->toArray());