diff options
author | Daniel Rudolf <github.com@daniel-rudolf.de> | 2020-05-12 15:18:26 +0300 |
---|---|---|
committer | Daniel Rudolf <github.com@daniel-rudolf.de> | 2020-05-12 15:21:56 +0300 |
commit | 2efadfb80d5eec9266c02a69939917bd85335ccf (patch) | |
tree | 53cde4a099a2fc3f3196e58578dd79a9ad2b1edd /lib | |
parent | 4ef48ab3252648413505f38cb53e08b962b777c3 (diff) |
Various small improvements
Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Command/Room/Add.php | 5 | ||||
-rw-r--r-- | lib/Command/Room/Create.php | 7 | ||||
-rw-r--r-- | lib/Command/Room/Demote.php | 5 | ||||
-rw-r--r-- | lib/Command/Room/Promote.php | 5 | ||||
-rw-r--r-- | lib/Command/Room/Remove.php | 5 | ||||
-rw-r--r-- | lib/Command/Room/Update.php | 5 |
6 files changed, 13 insertions, 19 deletions
diff --git a/lib/Command/Room/Add.php b/lib/Command/Room/Add.php index 04355b93d..3001127ea 100644 --- a/lib/Command/Room/Add.php +++ b/lib/Command/Room/Add.php @@ -24,12 +24,11 @@ declare(strict_types=1); namespace OCA\Talk\Command\Room; -use Exception; +use InvalidArgumentException; use OC\Core\Command\Base; use OCA\Talk\Exceptions\RoomNotFoundException; use OCA\Talk\Manager; use OCA\Talk\Room; -use OCP\IUserManager; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -95,7 +94,7 @@ class Add extends Base { $this->addRoomParticipants($room, $users); $this->addRoomParticipantsByGroup($room, $groups); $this->addRoomParticipantsByCircle($room, $circles); - } catch (Exception $e) { + } catch (InvalidArgumentException $e) { $output->writeln(sprintf('<error>%s</error>', $e->getMessage())); return 1; } diff --git a/lib/Command/Room/Create.php b/lib/Command/Room/Create.php index 95a395158..26b197dff 100644 --- a/lib/Command/Room/Create.php +++ b/lib/Command/Room/Create.php @@ -24,10 +24,9 @@ declare(strict_types=1); namespace OCA\Talk\Command\Room; -use Exception; +use InvalidArgumentException; use OC\Core\Command\Base; use OCA\Talk\Manager; -use OCP\IUserManager; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -109,7 +108,7 @@ class Create extends Base { $name = trim($name); if (!$this->validateRoomName($name)) { - $output->writeln("<error>Invalid room name.</error>"); + $output->writeln('<error>Invalid room name.</error>'); return 1; } @@ -130,7 +129,7 @@ class Create extends Base { if ($owner !== null) { $this->setRoomOwner($room, $owner); } - } catch (Exception $e) { + } catch (InvalidArgumentException $e) { $room->deleteRoom(); $output->writeln(sprintf('<error>%s</error>', $e->getMessage())); diff --git a/lib/Command/Room/Demote.php b/lib/Command/Room/Demote.php index cc470b7b1..0b4f8bac4 100644 --- a/lib/Command/Room/Demote.php +++ b/lib/Command/Room/Demote.php @@ -24,12 +24,11 @@ declare(strict_types=1); namespace OCA\Talk\Command\Room; -use Exception; +use InvalidArgumentException; use OC\Core\Command\Base; use OCA\Talk\Exceptions\RoomNotFoundException; use OCA\Talk\Manager; use OCA\Talk\Room; -use OCP\IUserManager; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -79,7 +78,7 @@ class Demote extends Base { try { $this->removeRoomModerators($room, $users); - } catch (Exception $e) { + } catch (InvalidArgumentException $e) { $output->writeln(sprintf('<error>%s</error>', $e->getMessage())); return 1; } diff --git a/lib/Command/Room/Promote.php b/lib/Command/Room/Promote.php index 3f30621d2..e978e8dae 100644 --- a/lib/Command/Room/Promote.php +++ b/lib/Command/Room/Promote.php @@ -24,12 +24,11 @@ declare(strict_types=1); namespace OCA\Talk\Command\Room; -use Exception; +use InvalidArgumentException; use OC\Core\Command\Base; use OCA\Talk\Exceptions\RoomNotFoundException; use OCA\Talk\Manager; use OCA\Talk\Room; -use OCP\IUserManager; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -79,7 +78,7 @@ class Promote extends Base { try { $this->addRoomModerators($room, $users); - } catch (Exception $e) { + } catch (InvalidArgumentException $e) { $output->writeln(sprintf('<error>%s</error>', $e->getMessage())); return 1; } diff --git a/lib/Command/Room/Remove.php b/lib/Command/Room/Remove.php index c054e36db..016e8c608 100644 --- a/lib/Command/Room/Remove.php +++ b/lib/Command/Room/Remove.php @@ -24,12 +24,11 @@ declare(strict_types=1); namespace OCA\Talk\Command\Room; -use Exception; +use InvalidArgumentException; use OC\Core\Command\Base; use OCA\Talk\Exceptions\RoomNotFoundException; use OCA\Talk\Manager; use OCA\Talk\Room; -use OCP\IUserManager; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -79,7 +78,7 @@ class Remove extends Base { try { $this->removeRoomParticipants($room, $users); - } catch (Exception $e) { + } catch (InvalidArgumentException $e) { $output->writeln(sprintf('<error>%s</error>', $e->getMessage())); return 1; } diff --git a/lib/Command/Room/Update.php b/lib/Command/Room/Update.php index b04b76cb6..84d52bd92 100644 --- a/lib/Command/Room/Update.php +++ b/lib/Command/Room/Update.php @@ -24,12 +24,11 @@ declare(strict_types=1); namespace OCA\Talk\Command\Room; -use Exception; +use InvalidArgumentException; use OC\Core\Command\Base; use OCA\Talk\Exceptions\RoomNotFoundException; use OCA\Talk\Manager; use OCA\Talk\Room; -use OCP\IUserManager; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -137,7 +136,7 @@ class Update extends Base { $this->unsetRoomOwner($room); } } - } catch (Exception $e) { + } catch (InvalidArgumentException $e) { $output->writeln(sprintf('<error>%s</error>', $e->getMessage())); return 1; } |