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

This commit is contained in:
Hypolite Petovan
2023-10-11 09:20:49 -04:00
parent 7f846f153d
commit 7486ebdc10
52 changed files with 76 additions and 73 deletions

View File

@@ -57,14 +57,11 @@ class Error extends BaseFactory
return new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
}
public function UnprocessableEntity(string $error = '')
public function UnprocessableEntity(string $error = ''): \Friendica\Object\Api\Mastodon\Error
{
$error = $error ?: $this->l10n->t('Unprocessable Entity');
$error_description = '';
$errorObj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
$this->logError(422, $error);
$this->jsonError(422, $errorObj->toArray());
return new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
}
public function Unauthorized(string $error = '', string $error_description = '')