fix: Event creation could still throw uncaught exceptions

This commit is contained in:
stefan.tollkuehn committed 2026-10-08 13:56:49 +02:00
1 parent d485640f57
commit 9abacef435
4 files changed
+32 -5

No files matched your search

+2 -1
View File
@@ -29,7 +29,8 @@
"Organizer contains invalid characters.": "Der Organisator enthält ungültige Zeichen.",
"Invalid organizer email address.": "Ungültige E-Mail-Adresse des Organisators.",
"No writable calendar was found in your account. Create one in the Nextcloud Calendar app, then try again.": "In deinem Konto wurde kein beschreibbarer Kalender gefunden. Erstelle einen in der Nextcloud-Kalender-App und versuche es erneut.",
"The selected calendar is no longer writable. Pick another one and try again.": "Der ausgewählte Kalender ist nicht mehr beschreibbar. Wähle einen anderen aus und versuche es erneut."
"The selected calendar is no longer writable. Pick another one and try again.": "Der ausgewählte Kalender ist nicht mehr beschreibbar. Wähle einen anderen aus und versuche es erneut.",
"The event could not be created. Please try again.": "Das Meeting konnte nicht erstellt werden. Bitte versuche es erneut."
},
"pluralForms": "nplurals=2; plural=(n != 1);"
}
+2 -1
View File
@@ -29,7 +29,8 @@
"Organizer contains invalid characters.": "Der Organisator enthält ungültige Zeichen.",
"Invalid organizer email address.": "Ungültige E-Mail-Adresse des Organisators.",
"No writable calendar was found in your account. Create one in the Nextcloud Calendar app, then try again.": "In Ihrem Konto wurde kein beschreibbarer Kalender gefunden. Erstellen Sie einen in der Nextcloud-Kalender-App und versuchen Sie es erneut.",
"The selected calendar is no longer writable. Pick another one and try again.": "Der ausgewählte Kalender ist nicht mehr beschreibbar. Wählen Sie einen anderen aus und versuchen Sie es erneut."
"The selected calendar is no longer writable. Pick another one and try again.": "Der ausgewählte Kalender ist nicht mehr beschreibbar. Wählen Sie einen anderen aus und versuchen Sie es erneut.",
"The event could not be created. Please try again.": "Das Meeting konnte nicht erstellt werden. Bitte versuchen Sie es erneut."
},
"pluralForms": "nplurals=2; plural=(n != 1);"
}
+2 -1
View File
@@ -29,7 +29,8 @@
"Organizer contains invalid characters.": "Organizer contains invalid characters.",
"Invalid organizer email address.": "Invalid organizer email address.",
"No writable calendar was found in your account. Create one in the Nextcloud Calendar app, then try again.": "No writable calendar was found in your account. Create one in the Nextcloud Calendar app, then try again.",
"The selected calendar is no longer writable. Pick another one and try again.": "The selected calendar is no longer writable. Pick another one and try again."
"The selected calendar is no longer writable. Pick another one and try again.": "The selected calendar is no longer writable. Pick another one and try again.",
"The event could not be created. Please try again.": "The event could not be created. Please try again."
},
"pluralForms": "nplurals=2; plural=(n != 1);"
}
+26 -2
View File
@@ -20,6 +20,7 @@ use OCP\IURLGenerator;
use OCP\IUserSession;
use OCP\IDateTimeZone;
use OCP\IL10N;
use Psr\Log\LoggerInterface;
use Sabre\VObject\Reader;
class CalendarController extends Controller
@@ -67,6 +68,7 @@ class CalendarController extends Controller
private IURLGenerator $urlGenerator;
private IDateTimeZone $dateTimeZone;
private IL10N $l10n;
private LoggerInterface $logger;
public function __construct(
string $appName,
@@ -76,7 +78,8 @@ class CalendarController extends Controller
IUserSession $userSession,
IURLGenerator $urlGenerator,
IDateTimeZone $dateTimeZone,
IL10N $l10n
IL10N $l10n,
LoggerInterface $logger
) {
parent::__construct($appName, $request);
@@ -86,6 +89,7 @@ class CalendarController extends Controller
$this->urlGenerator = $urlGenerator;
$this->dateTimeZone = $dateTimeZone;
$this->l10n = $l10n;
$this->logger = $logger;
}
/**
@@ -202,7 +206,27 @@ class CalendarController extends Controller
);
}
$this->createEvent($calendar, $data);
/*
* Backend failures, e.g. CalendarException, must not end
* in a generic 500 page. Log the cause, re-render the form.
*/
try {
$this->createEvent($calendar, $data);
} catch (\Throwable $e) {
$this->logger->error(
'Failed to create calendar event: ' . $e->getMessage(),
['exception' => $e]
);
return $this->renderConfirm(
$data,
$calendars,
$calendarId,
$this->l10n->t(
'The event could not be created. Please try again.'
)
);
}
/*
* Open the Nextcloud Calendar application if enabled,