From 9527fbb2cf3b35ad36be396c45ba34c3c5650a35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= <jan.bednarik@gmail.com>
Date: Mon, 29 Jun 2020 14:41:33 +0200
Subject: [PATCH] calendar utils: Handle calendar sync fails

---
 .../management/commands/update_callendars.py          | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/calendar_utils/management/commands/update_callendars.py b/calendar_utils/management/commands/update_callendars.py
index facfef933..ef6de3dce 100644
--- a/calendar_utils/management/commands/update_callendars.py
+++ b/calendar_utils/management/commands/update_callendars.py
@@ -7,6 +7,13 @@ class Command(BaseCommand):
     def handle(self, *args, **options):
         self.stdout.write("Updating calendars...")
         for cal in Calendar.objects.all():
-            self.stdout.write(f"+ {cal.url}")
-            cal.update_source()
+            self.stdout.write(f"@ {cal.url}")
+            try:
+                cal.update_source()
+                self.stdout.write("+ ok")
+            except Exception as e:
+                # TODO logging
+                self.stdout.write("- failed")
+                self.stderr.write(e)
+
         self.stdout.write("Updating calendars finished!")
-- 
GitLab