diff --git a/l10n/de.json b/l10n/de.json index 76f506e..1826aa5 100644 --- a/l10n/de.json +++ b/l10n/de.json @@ -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);" } diff --git a/l10n/de_DE.json b/l10n/de_DE.json index 3003f32..386dfca 100644 --- a/l10n/de_DE.json +++ b/l10n/de_DE.json @@ -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);" } diff --git a/l10n/en.json b/l10n/en.json index 1defbc3..5de1e44 100644 --- a/l10n/en.json +++ b/l10n/en.json @@ -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);" } diff --git a/lib/Controller/CalendarController.php b/lib/Controller/CalendarController.php index ac8b482..17087c2 100644 --- a/lib/Controller/CalendarController.php +++ b/lib/Controller/CalendarController.php @@ -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,