summaryrefslogtreecommitdiffstats
path: root/lib/Controller
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2018-12-29 13:07:57 -0100
committerMaxence Lange <maxence@artificial-owl.com>2018-12-29 13:07:57 -0100
commited98204d47421587300a6c576df5edb4cdf9e2c3 (patch)
tree4c8913b406c096411ed0a7ba061e114652a03e91 /lib/Controller
parent1a7b1c854962afbf62abd75c2830d5da4f422667 (diff)
rewrite of the exceptions while requesting remote instance
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/Controller')
-rw-r--r--lib/Controller/ActivityPubController.php11
-rw-r--r--lib/Controller/QueueController.php2
-rw-r--r--lib/Controller/SocialPubController.php5
3 files changed, 13 insertions, 5 deletions
diff --git a/lib/Controller/ActivityPubController.php b/lib/Controller/ActivityPubController.php
index 9e0a9a84..517b60cd 100644
--- a/lib/Controller/ActivityPubController.php
+++ b/lib/Controller/ActivityPubController.php
@@ -35,7 +35,8 @@ use Exception;
use OC\AppFramework\Http;
use OCA\Social\AppInfo\Application;
use OCA\Social\Exceptions\SignatureIsGoneException;
-use OCA\Social\Exceptions\UnknownItemException;
+use OCA\Social\Exceptions\ItemUnknownException;
+use OCA\Social\Exceptions\UrlCloudException;
use OCA\Social\Service\CacheActorService;
use OCA\Social\Service\FollowService;
use OCA\Social\Service\ImportService;
@@ -112,6 +113,7 @@ class ActivityPubController extends Controller {
* @param string $username
*
* @return Response
+ * @throws UrlCloudException
*/
public function actor(string $username): Response {
if (!$this->checkSourceActivityStreams()) {
@@ -143,6 +145,7 @@ class ActivityPubController extends Controller {
* @param string $username
*
* @return Response
+ * @throws UrlCloudException
*/
public function actorAlias(string $username): Response {
return $this->actor($username);
@@ -172,7 +175,7 @@ class ActivityPubController extends Controller {
try {
$this->importService->parseIncomingRequest($activity);
- } catch (UnknownItemException $e) {
+ } catch (ItemUnknownException $e) {
}
return $this->success([]);
@@ -213,7 +216,7 @@ class ActivityPubController extends Controller {
try {
$this->importService->parseIncomingRequest($activity);
- } catch (UnknownItemException $e) {
+ } catch (ItemUnknownException $e) {
}
return $this->success([]);
@@ -249,6 +252,7 @@ class ActivityPubController extends Controller {
* @param string $username
*
* @return Response
+ * @throws UrlCloudException
*/
public function followers(string $username): Response {
@@ -278,6 +282,7 @@ class ActivityPubController extends Controller {
* @param string $username
*
* @return Response
+ * @throws UrlCloudException
*/
public function following(string $username): Response {
if (!$this->checkSourceActivityStreams()) {
diff --git a/lib/Controller/QueueController.php b/lib/Controller/QueueController.php
index bd764050..4fd4c10f 100644
--- a/lib/Controller/QueueController.php
+++ b/lib/Controller/QueueController.php
@@ -32,7 +32,6 @@ namespace OCA\Social\Controller;
use daita\MySmallPhpTools\Traits\TAsync;
use OCA\Social\AppInfo\Application;
-use OCA\Social\Exceptions\RequestException;
use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Model\RequestQueue;
use OCA\Social\Service\ActivityService;
@@ -99,7 +98,6 @@ class QueueController extends Controller {
$request->setTimeout(ActivityService::TIMEOUT_ASYNC);
try {
$this->activityService->manageRequest($request);
- } catch (RequestException $e) {
} catch (SocialAppConfigException $e) {
}
}
diff --git a/lib/Controller/SocialPubController.php b/lib/Controller/SocialPubController.php
index 18c669d1..ce9f131b 100644
--- a/lib/Controller/SocialPubController.php
+++ b/lib/Controller/SocialPubController.php
@@ -34,6 +34,7 @@ use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
use OCA\Social\AppInfo\Application;
use OCA\Social\Exceptions\CacheActorDoesNotExistException;
+use OCA\Social\Exceptions\UrlCloudException;
use OCA\Social\Service\AccountService;
use OCA\Social\Service\CacheActorService;
use OCA\Social\Service\FollowService;
@@ -117,6 +118,7 @@ class SocialPubController extends Controller {
$page = new PublicTemplateResponse(Application::APP_NAME, 'main', $data);
$page->setStatus($status);
$page->setHeaderTitle($this->l10n->t('Social'));
+
return $page;
}
@@ -131,6 +133,7 @@ class SocialPubController extends Controller {
* @param string $username
*
* @return Response
+ * @throws UrlCloudException
*/
public function actor(string $username): Response {
return $this->renderPage($username);
@@ -147,6 +150,7 @@ class SocialPubController extends Controller {
* @param string $username
*
* @return TemplateResponse
+ * @throws UrlCloudException
*/
public function followers(string $username): Response {
return $this->renderPage($username);
@@ -163,6 +167,7 @@ class SocialPubController extends Controller {
* @param string $username
*
* @return TemplateResponse
+ * @throws UrlCloudException
*/
public function following(string $username): Response {
return $this->renderPage($username);