add error handling for calendar object creation and update processes
This commit is contained in:
parent
22f5d8f535
commit
b34c0ff13a
@ -25,6 +25,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace OCA\Gestion\Listener;
|
||||
|
||||
use Exception;
|
||||
use OCA\DAV\Events\CalendarObjectCreatedEvent;
|
||||
use OCA\Gestion\Service\GestionService;
|
||||
use OCP\EventDispatcher\Event;
|
||||
@ -50,8 +51,16 @@ class CalendarObjectCreatedListener implements IEventListener {
|
||||
return;
|
||||
}
|
||||
$calendarData = $event->getObjectData();
|
||||
try{
|
||||
$vCalendarString = $calendarData["calendardata"];
|
||||
$this->gestionService->HandleCreatedCalendarObject($vCalendarString);
|
||||
}
|
||||
catch(\OC\OCS\Exception $e){
|
||||
$this->logger->error("Error while handling created calendar object: ".$e->getMessage());
|
||||
}
|
||||
catch(Exception $e){
|
||||
$this->logger->error("Error while handling created calendar object: ".$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace OCA\Gestion\Listener;
|
||||
|
||||
use Exception;
|
||||
use OCA\DAV\Events\CalendarObjectCreatedEvent;
|
||||
use OCA\DAV\Events\CalendarObjectUpdatedEvent;
|
||||
use OCA\Gestion\Service\GestionService;
|
||||
@ -51,8 +52,16 @@ class CalendarObjectUpdatedListener implements IEventListener {
|
||||
return;
|
||||
}
|
||||
$calendarData = $event->getObjectData();
|
||||
try{
|
||||
$vCalendarString = $calendarData["calendardata"];
|
||||
$this->gestionService->HandleUpdatedCalendarObject($vCalendarString);
|
||||
}
|
||||
catch(\OC\OCS\Exception $e){
|
||||
$this->logger->error("Error while handling updated calendar object: ".$e->getMessage());
|
||||
}
|
||||
catch(Exception $e){
|
||||
$this->logger->error("Error while handling updated calendar object: ".$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace OCA\Gestion\Service;
|
||||
|
||||
use Exception;
|
||||
use OCA\Gestion\Constants\BddConstant;
|
||||
use OCA\Gestion\Constants\DevisMentionConstant;
|
||||
use OCA\Gestion\Constants\VCalendarPropertyConstant;
|
||||
@ -205,6 +206,7 @@ class GestionService {
|
||||
}
|
||||
|
||||
public function HandleUpdatedCalendarObject(string $vCalendarString){
|
||||
try{
|
||||
$isCalendarForLeave = $this->GetIsLeaveFromVCalendarString($vCalendarString);
|
||||
if($isCalendarForLeave){
|
||||
//from devis calendar to leave calendar
|
||||
@ -234,6 +236,13 @@ class GestionService {
|
||||
//update from calendar leave or calendar pending to calendar devis
|
||||
$this->HandleCreatedCalendarObject($vCalendarString);
|
||||
}
|
||||
}
|
||||
catch(\OC\OCS\Exception $e){
|
||||
$this->logger->error("Error while handling created calendar object: ".$e->getMessage());
|
||||
}
|
||||
catch(Exception $e){
|
||||
$this->logger->error("Error while handling created calendar object: ".$e->getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -259,6 +268,7 @@ class GestionService {
|
||||
}
|
||||
|
||||
public function HandleCreatedCalendarObject(string $vCalendarString){
|
||||
try{
|
||||
$isCalendarForLeave = $this->GetIsLeaveFromVCalendarString($vCalendarString);
|
||||
if($isCalendarForLeave){
|
||||
return;
|
||||
@ -290,6 +300,13 @@ class GestionService {
|
||||
$this->talkService->sendDevisTalkNotifications($devisTalkMessage,$userName,$this->userConnectedUuid);
|
||||
$this->gestionBdd->createDevisTrajetFromVCalendar($devisId,$userName);
|
||||
}
|
||||
catch(\OC\OCS\Exception $e){
|
||||
$this->logger->error("Error while handling created calendar object: ".$e->getMessage());
|
||||
}
|
||||
catch(Exception $e){
|
||||
$this->logger->error("Error while handling created calendar object: ".$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private function GetThanatoNameFromVCalendarString($vCalendarString){
|
||||
$thanatoName = $this->getPrincipalUsernameFromVCalendarString($vCalendarString);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user