Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2020-06-22 19:55:42 +0300
committerdartcafe <github@dartcafe.de>2020-06-22 19:55:42 +0300
commit863d50ecfa2963664cb16892d31af65ad3289b5e (patch)
treea7e602e4bba24c103d4fd071b29e6e4c1cb314d0 /lib/Controller/SubscriptionController.php
parent0d632d59b202f55da389db28b870b8c64416c00f (diff)
code maintenance
Diffstat (limited to 'lib/Controller/SubscriptionController.php')
-rw-r--r--lib/Controller/SubscriptionController.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Controller/SubscriptionController.php b/lib/Controller/SubscriptionController.php
index f3cc655a..194b97e6 100644
--- a/lib/Controller/SubscriptionController.php
+++ b/lib/Controller/SubscriptionController.php
@@ -25,6 +25,7 @@ namespace OCA\Polls\Controller;
use Exception;
use OCP\AppFramework\Db\DoesNotExistException;
+use OCA\Polls\Exceptions\NotAuthorizedException;
use OCP\IRequest;
use OCP\ILogger;
@@ -73,9 +74,9 @@ class SubscriptionController extends Controller {
try {
return new DataResponse($this->subscriptionService->get($pollId), Http::STATUS_OK);
} catch (NotAuthorizedException $e) {
- return new DataResponse('Unauthorized', Http::STATUS_FORBIDDEN);
+ return new DataResponse(['error' => $e->getMessage()], $e->getStatus());
} catch (DoesNotExistException $e) {
- return new DataResponse('Not subscribed', Http::STATUS_NOT_FOUND);
+ return new DataResponse(['error' => 'Not subscribed'], Http::STATUS_NOT_FOUND);
}
}
@@ -88,7 +89,7 @@ class SubscriptionController extends Controller {
try {
return new DataResponse($this->subscriptionService->set($pollId, $subscribed), Http::STATUS_OK);
} catch (NotAuthorizedException $e) {
- return new DataResponse('Unauthorized', Http::STATUS_FORBIDDEN);
+ return new DataResponse(['error' => $e->getMessage()], $e->getStatus());
}
}
}