add error handling for calendar object moved events in GestionService

This commit is contained in:
Tiavina 2025-03-26 19:50:54 +03:00
parent b34c0ff13a
commit 6ac8fc9ecc
2 changed files with 33 additions and 16 deletions

View File

@ -25,6 +25,7 @@ declare(strict_types=1);
namespace OCA\Gestion\Listener; namespace OCA\Gestion\Listener;
use Exception;
use OCA\DAV\Events\CalendarObjectMovedEvent; use OCA\DAV\Events\CalendarObjectMovedEvent;
use OCA\Gestion\Service\GestionService; use OCA\Gestion\Service\GestionService;
use OCP\EventDispatcher\Event; use OCP\EventDispatcher\Event;
@ -50,9 +51,17 @@ class CalendarObjectMovedListener implements IEventListener {
return; return;
} }
$calendarData = $event->getObjectData(); $calendarData = $event->getObjectData();
try{
$targetCalendarId = $event->getTargetCalendarId(); $targetCalendarId = $event->getTargetCalendarId();
$vCalendarString = $calendarData["calendardata"]; $vCalendarString = $calendarData["calendardata"];
$this->gestionService->HandleCalendarObjectMoved($vCalendarString,$targetCalendarId); $this->gestionService->HandleCalendarObjectMoved($vCalendarString,$targetCalendarId);
} }
catch(Exception $e){
$this->logger->error("Error while handling calendar object moved event: ".$e->getMessage());
}
catch(Exception $e){
$this->logger->error("Error while handling calendar object moved event: ".$e->getMessage());
}
}
} }

View File

@ -247,6 +247,7 @@ class GestionService {
} }
public function HandleCalendarObjectMoved(string $vCalendarString,$targetCalendarId){ public function HandleCalendarObjectMoved(string $vCalendarString,$targetCalendarId){
try{
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString); $calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
$isCalendarForLeave = $this->GetIsLeaveFromVCalendarString($vCalendarString); $isCalendarForLeave = $this->GetIsLeaveFromVCalendarString($vCalendarString);
$isCalendarDevis = $isCalendarForLeave == false; $isCalendarDevis = $isCalendarForLeave == false;
@ -266,6 +267,13 @@ class GestionService {
} }
} }
} }
catch(\OC\OCS\Exception $e){
$this->logger->error("Error while handling calendar object moved event: ".$e->getMessage());
}
catch(Exception $e){
$this->logger->error("Error while handling calendar object moved event: ".$e->getMessage());
}
}
public function HandleCreatedCalendarObject(string $vCalendarString){ public function HandleCreatedCalendarObject(string $vCalendarString){
try{ try{