зеркало из https://github.com/nextcloud/spreed.git
Import exception
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Родитель
7aedf936ba
Коммит
71caa05f1c
|
@ -96,7 +96,7 @@ class Create extends Base {
|
|||
$roomType = $public ? Room::PUBLIC_CALL : Room::GROUP_CALL;
|
||||
try {
|
||||
$room = $this->roomService->createConversation($roomType, $name);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
} catch (InvalidArgumentException $e) {
|
||||
if ($e->getMessage() === 'name') {
|
||||
$output->writeln('<error>Invalid room name.</error>');
|
||||
return 1;
|
||||
|
|
|
@ -27,6 +27,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Talk\Controller;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use OCA\Circles\Api\v1\Circles;
|
||||
use OCA\Circles\Model\Member;
|
||||
use OCA\Talk\Chat\ChatManager;
|
||||
|
@ -612,7 +613,7 @@ class RoomController extends AEnvironmentAwareController {
|
|||
try {
|
||||
$room = $this->roomService->createOneToOneConversation($currentUser, $targetUser);
|
||||
return new DataResponse($this->formatRoom($room, $room->getParticipant($currentUser->getUID())), Http::STATUS_CREATED);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
} catch (InvalidArgumentException $e) {
|
||||
// Same current and target user
|
||||
return new DataResponse([], Http::STATUS_FORBIDDEN);
|
||||
} catch (RoomNotFoundException $e) {
|
||||
|
@ -736,7 +737,7 @@ class RoomController extends AEnvironmentAwareController {
|
|||
// Create the room
|
||||
try {
|
||||
$room = $this->roomService->createConversation($roomType, $roomName, $currentUser);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
} catch (InvalidArgumentException $e) {
|
||||
return new DataResponse([], Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Talk\Tests\php\Command\Room;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use OCA\Talk\Command\Room\Create;
|
||||
use OCA\Talk\Manager;
|
||||
use OCA\Talk\Participant;
|
||||
|
@ -290,7 +291,7 @@ class CreateTest extends TestCase {
|
|||
if ($input['name'] !== 'PHPUnit Test Room') {
|
||||
$this->roomService
|
||||
->method('createConversation')
|
||||
->willThrowException(new \InvalidArgumentException('name'));
|
||||
->willThrowException(new InvalidArgumentException('name'));
|
||||
} else {
|
||||
$this->roomService
|
||||
->method('createConversation')
|
||||
|
|
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Talk\Tests\php\Service;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use OCA\Talk\Exceptions\RoomNotFoundException;
|
||||
use OCA\Talk\Manager;
|
||||
use OCA\Talk\Participant;
|
||||
|
@ -54,7 +55,7 @@ class RoomServiceTest extends TestCase {
|
|||
$user->method('getUID')
|
||||
->willReturn('uid');
|
||||
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('invalid_invitee');
|
||||
$this->service->createOneToOneConversation($user, $user);
|
||||
}
|
||||
|
@ -129,7 +130,7 @@ class RoomServiceTest extends TestCase {
|
|||
$this->manager->expects($this->never())
|
||||
->method('createRoom');
|
||||
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('name');
|
||||
$this->service->createConversation(Room::GROUP_CALL, $name);
|
||||
}
|
||||
|
@ -150,7 +151,7 @@ class RoomServiceTest extends TestCase {
|
|||
$this->manager->expects($this->never())
|
||||
->method('createRoom');
|
||||
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('type');
|
||||
$this->service->createConversation($type, 'abc');
|
||||
}
|
||||
|
@ -174,7 +175,7 @@ class RoomServiceTest extends TestCase {
|
|||
$this->manager->expects($this->never())
|
||||
->method('createRoom');
|
||||
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage($exception);
|
||||
$this->service->createConversation(Room::PUBLIC_CALL, 'a', null, $type, $id);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче