summaryrefslogtreecommitdiffstats
path: root/lib/Controller/RecordingController.php
diff options
context:
space:
mode:
authorVitor Mattos <vitor@php.rio>2022-12-12 16:37:39 -0300
committerVitor Mattos <vitor@php.rio>2022-12-12 16:37:39 -0300
commit55691b076a779e7079076ab9c18ae706aa5c2701 (patch)
tree4f4092014d4a05845136df6a80debd598184eec7 /lib/Controller/RecordingController.php
parent1c3d218845a9a2d35dc695bb2491ec27a06e40f0 (diff)
Make more specific the validation to start and stop recordin
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'lib/Controller/RecordingController.php')
-rw-r--r--lib/Controller/RecordingController.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Controller/RecordingController.php b/lib/Controller/RecordingController.php
index cacf6e9c5..9931258a2 100644
--- a/lib/Controller/RecordingController.php
+++ b/lib/Controller/RecordingController.php
@@ -46,8 +46,10 @@ class RecordingController extends AEnvironmentAwareController {
* @RequireModeratorParticipant
*/
public function startRecording(int $status): DataResponse {
- if (!$this->roomService->startRecording($this->room, $status)) {
- return new DataResponse([], Http::STATUS_BAD_REQUEST);
+ try {
+ $this->roomService->startRecording($this->room, $status)
+ } catch (InvalidArgumentException $e) {
+ return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
}
return new DataResponse();
}
@@ -58,7 +60,11 @@ class RecordingController extends AEnvironmentAwareController {
* @RequireModeratorParticipant
*/
public function stopRecording(): DataResponse {
- $this->roomService->stopRecording($this->room);
+ try {
+ $this->roomService->stopRecording($this->room);
+ } catch (InvalidArgumentException $e) {
+ return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
+ }
return new DataResponse();
}
}