From db206c15e2edb6af7b42ad7e32f7bcbdf8c69f37 Mon Sep 17 00:00:00 2001
From: Ernesto Rico Schmidt <ernesto@helsinki.at>
Date: Thu, 23 Nov 2023 18:48:12 -0400
Subject: [PATCH] fix: return the exception's string representation

---
 program/views.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/program/views.py b/program/views.py
index 069d9cc5..418bcd2f 100644
--- a/program/views.py
+++ b/program/views.py
@@ -614,11 +614,8 @@ class APIScheduleViewSet(
             resolution = resolve_conflicts(request.data, pk, show_pk)
         # FIXME: Find a better way to do this.
         # The exception is thrown by the instantiate_upcoming_schedule function.
-        except RRule.DoesNotExist:
-            return JsonResponse(
-                {"rruleId": ["Ungültige rrule - Object existiert nicht."]},
-                status=status.HTTP_400_BAD_REQUEST,
-            )
+        except RRule.DoesNotExist as exc:
+            return JsonResponse({"rruleId": str(exc)}, status=status.HTTP_400_BAD_REQUEST)
         except ScheduleConflictError as exc:
             return Response(exc.conflicts, status.HTTP_409_CONFLICT)
 
-- 
GitLab