X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FBaseApi.php;h=dc75b0dd262fc0da5a3ad206fc80e563a45323f2;hb=3bca4fe2a64671d09e08346456cdfa6c12f996e9;hp=95eb8f04249d005eef54a5162b1d4e8f16c51eec;hpb=9e7161071153c7ec5e4df5711521cbcaabcbc353;p=friendica.git diff --git a/src/Module/BaseApi.php b/src/Module/BaseApi.php index 95eb8f0424..dc75b0dd26 100644 --- a/src/Module/BaseApi.php +++ b/src/Module/BaseApi.php @@ -1,6 +1,6 @@ logger->notice('Empty application token'); - DI::mstdnError()->Forbidden(); + $this->logAndJsonError(403, $this->errorFactory->Forbidden()); } if (!isset($token[$scope])) { $this->logger->warning('The requested scope does not exist', ['scope' => $scope, 'application' => $token]); - DI::mstdnError()->Forbidden(); + $this->logAndJsonError(403, $this->errorFactory->Forbidden()); } if (empty($token[$scope])) { $this->logger->warning('The requested scope is not allowed', ['scope' => $scope, 'application' => $token]); - DI::mstdnError()->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());