Move jsonError out of Factory\Api\Mastodon\Error->Unauthorized

This commit is contained in:
Hypolite Petovan 2023-10-11 09:24:13 -04:00
parent 7486ebdc10
commit 6a2ca1a6b6
4 changed files with 10 additions and 13 deletions

View file

@ -64,13 +64,10 @@ class Error extends BaseFactory
return new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
}
public function Unauthorized(string $error = '', string $error_description = '')
public function Unauthorized(string $error = '', string $error_description = ''): \Friendica\Object\Api\Mastodon\Error
{
$error = $error ?: $this->l10n->t('Unauthorized');
$errorObj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
$this->logError(401, $error);
$this->jsonError(401, $errorObj->toArray());
return new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
}
public function Forbidden(string $error = '')