return new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
}
- public function InternalError(string $error = '')
+ public function InternalError(string $error = ''): \Friendica\Object\Api\Mastodon\Error
{
$error = $error ?: $this->l10n->t('Internal Server Error');
$error_description = '';
- $errorObj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
-
- $this->logError(500, $error);
- $this->jsonError(500, $errorObj->toArray());
+ return new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
}
}
}
if (!DBA::insert('application', $fields)) {
- DI::mstdnError()->InternalError();
+ $this->logErrorAndJsonExit(500, $this->errorFactory->InternalError());
}
$this->jsonExit(DI::mstdnApplication()->createFromApplicationId(DBA::lastInsertId())->toArray());
}
if (!Circle::remove($this->parameters['id'])) {
- DI::mstdnError()->InternalError();
+ $this->logErrorAndJsonExit(500, $this->errorFactory->InternalError());
}
$this->jsonExit([]);
$id = Circle::getIdByName($uid, $request['title']);
if (!$id) {
- DI::mstdnError()->InternalError();
+ $this->logErrorAndJsonExit(500, $this->errorFactory->InternalError());
}
$this->jsonExit(DI::mstdnList()->createFromCircleId($id));
$item['uri'] = Item::newURI($item['guid']);
$id = Post\Delayed::add($item['uri'], $item, Worker::PRIORITY_HIGH, Post\Delayed::PREPARED, DateTimeFormat::utc($request['scheduled_at']));
if (empty($id)) {
- DI::mstdnError()->InternalError();
+ $this->logErrorAndJsonExit(500, $this->errorFactory->InternalError());
}
$this->jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($id, $uid)->toArray());
}
}
}
- DI::mstdnError()->InternalError();
+ $this->logErrorAndJsonExit(500, $this->errorFactory->InternalError());
}
protected function delete(array $request = [])