Improved error messages

This commit is contained in:
Michael 2021-05-12 14:00:15 +00:00
parent 8a5560ec8f
commit 9125d296a1
17 changed files with 20 additions and 20 deletions

View file

@ -38,7 +38,7 @@ class Accounts extends BaseApi
public static function rawContent(array $parameters = [])
{
if (empty($parameters['id'])) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
$id = $parameters['id'];

View file

@ -41,7 +41,7 @@ class Followers extends BaseApi
$uid = self::getCurrentUserID();
if (empty($parameters['id'])) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
$id = $parameters['id'];

View file

@ -41,7 +41,7 @@ class Following extends BaseApi
$uid = self::getCurrentUserID();
if (empty($parameters['id'])) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
$id = $parameters['id'];

View file

@ -42,7 +42,7 @@ class Lists extends BaseApi
$uid = self::getCurrentUserID();
if (empty($parameters['id'])) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
$id = $parameters['id'];

View file

@ -43,7 +43,7 @@ class Statuses extends BaseApi
public static function rawContent(array $parameters = [])
{
if (empty($parameters['id'])) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
$id = $parameters['id'];

View file

@ -43,12 +43,12 @@ class VerifyCredentials extends BaseApi
$self = User::getOwnerDataById($uid);
if (empty($self)) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->InternalError();
}
$cdata = Contact::getPublicAndUserContacID($self['id'], $uid);
if (empty($cdata)) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->InternalError();
}
// @todo Support the source property,

View file

@ -41,7 +41,7 @@ class Blocks extends BaseApi
$uid = self::getCurrentUserID();
if (empty($parameters['id'])) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
$id = $parameters['id'];

View file

@ -53,7 +53,7 @@ class Accounts extends BaseApi
$uid = self::getCurrentUserID();
if (empty($parameters['id'])) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
$id = $parameters['id'];

View file

@ -46,7 +46,7 @@ class Media extends BaseApi
$uid = self::getCurrentUserID();
if (empty($parameters['id'])) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
$id = $parameters['id'];

View file

@ -41,7 +41,7 @@ class Mutes extends BaseApi
$uid = self::getCurrentUserID();
if (empty($parameters['id'])) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
$id = $parameters['id'];

View file

@ -42,7 +42,7 @@ class Statuses extends BaseApi
public static function rawContent(array $parameters = [])
{
if (empty($parameters['id'])) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], self::getCurrentUserID()));

View file

@ -41,7 +41,7 @@ class Context extends BaseApi
$uid = self::getCurrentUserID();
if (empty($parameters['id'])) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
$id = $parameters['id'];

View file

@ -41,7 +41,7 @@ class FavouritedBy extends BaseApi
$uid = self::getCurrentUserID();
if (empty($parameters['id'])) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
$id = $parameters['id'];

View file

@ -41,7 +41,7 @@ class RebloggedBy extends BaseApi
$uid = self::getCurrentUserID();
if (empty($parameters['id'])) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
$id = $parameters['id'];

View file

@ -43,7 +43,7 @@ class ListTimeline extends BaseApi
$uid = self::getCurrentUserID();
if (empty($parameters['id'])) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
// Return results older than id

View file

@ -44,7 +44,7 @@ class Tag extends BaseApi
$uid = self::getCurrentUserID();
if (empty($parameters['hashtag'])) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
// If true, return only local statuses. Defaults to false.

View file

@ -39,12 +39,12 @@ class Authorize extends BaseApi
$response_type = $_REQUEST['response_type'] ?? '';
if ($response_type != 'code') {
Logger::warning('Wrong or missing response type', ['response_type' => $response_type]);
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
$application = self::getApplication();
if (empty($application)) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
$request = $_REQUEST;
@ -68,7 +68,7 @@ class Authorize extends BaseApi
$token = self::createTokenForUser($application, $uid);
if (!$token) {
DI::mstdnError()->RecordNotFound();
DI::mstdnError()->UnprocessableEntity();
}
DI::app()->redirect($application['redirect_uri'] . '?code=' . $token['code']);